diff --git a/src/compiler/compile/render_ssr/handlers/Element.ts b/src/compiler/compile/render_ssr/handlers/Element.ts index d10c165198..33febebaa2 100644 --- a/src/compiler/compile/render_ssr/handlers/Element.ts +++ b/src/compiler/compile/render_ssr/handlers/Element.ts @@ -1,7 +1,9 @@ import { is_void } from '../../../utils/names'; +import isContenteditable, { isBindingContenteditable } from '../../utils/contenteditable'; import { get_attribute_value, get_class_attribute_value } from './shared/get_attribute_value'; import { boolean_attributes } from './shared/boolean_attributes'; import Renderer, { RenderOptions } from '../Renderer'; +import Binding from '../../nodes/Binding'; import Element from '../../nodes/Element'; import { x } from 'code-red'; import Expression from '../../nodes/shared/Expression'; @@ -14,11 +16,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption // awkward special case let node_contents; - const contenteditable = ( - node.name !== 'textarea' && - node.name !== 'input' && - node.attributes.some((attribute) => attribute.name === 'contenteditable') - ); + const contenteditable = isContenteditable(node); renderer.add_string(`<${node.name}`); @@ -95,7 +93,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption } } - node.bindings.forEach(binding => { + node.bindings.forEach((binding: Binding) => { const { name, expression } = binding; if (binding.is_readonly) { @@ -104,7 +102,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption if (name === 'group') { // TODO server-render group bindings - } else if (contenteditable && (name === 'textContent' || name === 'innerHTML')) { + } else if (contenteditable && isBindingContenteditable(binding)) { node_contents = expression.node; // TODO where was this used?