Skip to content

Clearing innerText does not correct update DOM #1146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Nokel81 opened this issue Oct 19, 2022 · 1 comment
Closed

Clearing innerText does not correct update DOM #1146

Nokel81 opened this issue Oct 19, 2022 · 1 comment
Labels
jsdom Issue with JSDOM environment

Comments

@Nokel81
Copy link
Contributor

Nokel81 commented Oct 19, 2022

Relevant code or config:

const result = render(<div id="my-div" />);
const myDiv = result.baseElement.querySelector("#my-div") as HTMLDivElement;
const newEntry = document.createElement("span");

newEntry.append("I am some text");

myDiv.appendChild(newEntry);
myDiv.innerText = "";
logDOM(myDiv);

This outputs:

<div
  id="my-div"
>
  <span>
    I am some text
  </span>
</div>

instead of what it should

<div
  id="my-div"
/>

What you did:

I am trying to test xterm and found that if I set innerHTML instead then this library produces the expected results.

What happened:

The child elements were not being cleared correctly.

Reproduction:

See above

Problem description:

It is incorrect behaviour according to the spec

Suggested solution:

Maybe this is required to be fixed in jsdom instead? (I found jsdom/jsdom#1245).


I am creating this issue because xtermjs/xterm.js#4214 was closed due to security concerns.

@eps1lon
Copy link
Member

eps1lon commented Oct 29, 2022

Maybe this is required to be fixed in jsdom instead? (I found jsdom/jsdom#1245).

Indeed. Closing in favor of jsdom/jsdom#1245

@eps1lon eps1lon closed this as completed Oct 29, 2022
@eps1lon eps1lon reopened this Oct 29, 2022
@eps1lon eps1lon closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2022
@eps1lon eps1lon added the jsdom Issue with JSDOM environment label Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jsdom Issue with JSDOM environment
Projects
None yet
Development

No branches or pull requests

2 participants