|
|
|
@ -289,7 +289,10 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
const isTemplate = this.node.name == 'template';
|
|
|
|
|
|
|
|
// skip textcontent logic for <template>. should append to the template .content
|
|
|
|
|
|
|
|
const isTemplateWithTextContent = isTemplate && can_use_textcontent;
|
|
|
|
|
|
|
|
if (!isTemplateWithTextContent && !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') {
|
|
|
|
block.chunks.create.push(
|
|
|
|
block.chunks.create.push(
|
|
|
|
b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};`
|
|
|
|
b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};`
|
|
|
|
|