Skip to content

Won't work when some extension add dom to body 😂😂😂 #162

@xiaoshuangLi

Description

@xiaoshuangLi

There is a strange issue.Some extension may add dom when the page is created.So initialContent won't be written to right place. Please help me. 😂😂😂

I think using doc.body.children.length is not safe. Maybe props.initialContent has empty body.

 /*
  *  entension may create dom before following code run
  *  so doc.body.children.length will not be 0
  **/
if (doc.body.children.length < 1) {
  doc.open('text/html', 'replace');
  doc.write(this.props.initialContent);
  doc.close();
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions