From 56cf9b864bf9f277e6eeef795e920ac8dd0ca1a3 Mon Sep 17 00:00:00 2001 From: himynameisdave Date: Sat, 24 Apr 2021 16:18:43 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=92=20Replace=20contenteditable=20cons?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/compile/utils/__test__.ts | 9 ++++----- src/compiler/compile/utils/contenteditable.ts | 7 ++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler/compile/utils/__test__.ts b/src/compiler/compile/utils/__test__.ts index 169d3aa920..1ee5e8477b 100644 --- a/src/compiler/compile/utils/__test__.ts +++ b/src/compiler/compile/utils/__test__.ts @@ -7,7 +7,6 @@ import { has_contenteditable_attr, is_name_contenteditable, get_contenteditable_attr, - CONTENTEDITABLE_ATTR, CONTENTEDITABLE_BINDINGS, } from './contenteditable'; import Element from '../nodes/Element'; @@ -43,7 +42,7 @@ describe('contenteditable', () => { assert.equal(is_contenteditable(node), false); }); it('returns true if node is not input or textarea AND it is contenteditable', () => { - const attr = { name: CONTENTEDITABLE_ATTR } as Attribute; + const attr = { name: 'contenteditable' } as Attribute; const node = { name: 'a', attributes: [attr] } as Element; assert.equal(is_contenteditable(node), true); }); @@ -66,7 +65,7 @@ describe('contenteditable', () => { describe('is_attr_contenteditable', () => { it('returns true if attribute is contenteditable', () => { - const attr = { name: CONTENTEDITABLE_ATTR } as Attribute; + const attr = { name: 'contenteditable' } as Attribute; assert.equal(is_attr_contenteditable(attr), true); }); it('returns false if attribute is not contenteditable', () => { @@ -78,7 +77,7 @@ describe('contenteditable', () => { describe('has_contenteditable_attr', () => { it('returns true if attribute is contenteditable', () => { - const attr = { name: CONTENTEDITABLE_ATTR } as Attribute; + const attr = { name: 'contenteditable' } as Attribute; const node = { attributes: [attr] } as Element; assert.equal(has_contenteditable_attr(node), true); }); @@ -100,7 +99,7 @@ describe('contenteditable', () => { describe('get_contenteditable_attr', () => { it('returns the contenteditable Attribute if it exists', () => { - const attr = { name: CONTENTEDITABLE_ATTR } as Attribute; + const attr = { name: 'contenteditable' } as Attribute; const node = { name: 'div', attributes: [attr] } as Element; assert.equal(get_contenteditable_attr(node), attr); }); diff --git a/src/compiler/compile/utils/contenteditable.ts b/src/compiler/compile/utils/contenteditable.ts index 0f186ea521..303baef67d 100644 --- a/src/compiler/compile/utils/contenteditable.ts +++ b/src/compiler/compile/utils/contenteditable.ts @@ -1,10 +1,7 @@ -// Utilities for managing contenteditable nodes +// Utilities for managing contenteditable nodes import Attribute from '../nodes/Attribute'; import Element from '../nodes/Element'; - -export const CONTENTEDITABLE_ATTR = 'contenteditable'; - export const CONTENTEDITABLE_BINDINGS = [ 'textContent', 'innerHTML', @@ -24,7 +21,7 @@ export function is_input_or_textarea(node: Element): boolean { * @param {Attribute} attribute A node.attribute */ export function is_attr_contenteditable(attribute: Attribute): boolean { - return attribute.name === CONTENTEDITABLE_ATTR; + return attribute.name === 'contenteditable'; } /**