revert unnecessary changes

pull/6898/head
baseballyama 5 years ago
parent 7b6dbcd228
commit 8560d7ca2b

@ -373,14 +373,13 @@ export default class ElementWrapper extends Wrapper {
block.chunks.destroy.push(b`if (detaching) @detach(${node});`); block.chunks.destroy.push(b`if (detaching) @detach(${node});`);
} }
let staticChildren = null;
// insert static children with textContent or innerHTML // insert static children with textContent or innerHTML
const can_use_textcontent = this.can_use_textcontent(); const can_use_textcontent = this.can_use_textcontent();
if (!this.node.namespace && (this.can_use_innerhtml || can_use_textcontent) && this.fragment.nodes.length > 0) { if (!this.node.namespace && (this.can_use_innerhtml || can_use_textcontent) && this.fragment.nodes.length > 0) {
if (this.fragment.nodes.length === 1 && this.fragment.nodes[0].node.type === 'Text') { if (this.fragment.nodes.length === 1 && this.fragment.nodes[0].node.type === 'Text') {
staticChildren = b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};`; block.chunks.create.push(
block.chunks.create.push(staticChildren); b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};`
);
} else { } else {
const state = { const state = {
quasi: { quasi: {
@ -399,8 +398,9 @@ export default class ElementWrapper extends Wrapper {
to_html((this.fragment.nodes as unknown as Array<ElementWrapper | TextWrapper>), block, literal, state, can_use_raw_text); to_html((this.fragment.nodes as unknown as Array<ElementWrapper | TextWrapper>), block, literal, state, can_use_raw_text);
literal.quasis.push(state.quasi); literal.quasis.push(state.quasi);
staticChildren = b`${node}.${this.can_use_innerhtml ? 'innerHTML' : 'textContent'} = ${literal};`; block.chunks.create.push(
block.chunks.create.push(staticChildren); b`${node}.${this.can_use_innerhtml ? 'innerHTML' : 'textContent'} = ${literal};`
);
} }
} else { } else {
this.fragment.nodes.forEach((child: Wrapper) => { this.fragment.nodes.forEach((child: Wrapper) => {

Loading…
Cancel
Save