Skip to content
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

null textContent value for DocumentFragment #231

Open
davecardwell opened this issue Oct 20, 2023 · 0 comments · May be fixed by #278
Open

null textContent value for DocumentFragment #231

davecardwell opened this issue Oct 20, 2023 · 0 comments · May be fixed by #278

Comments

@davecardwell
Copy link

The .textContent attribute of a DocumentFragment—such as the one returned by a <template>’s .content attribute—is null.

import { parseHTML } from "linkedom";

const { document } = parseHTML("");

const template = document.createElement("template");
template.innerHTML = "foo <span>bar</span>";

// in linkedom this is "foo bar", in browsers it’s an empty string
console.log(template.innerText);

const documentFragment = template.content;

// in linkedom this is null, in browsers it’s "foo bar"
console.log(documentFragment.textContent);
iacore pushed a commit to iacore/linkedom that referenced this issue Jun 9, 2024
@iacore iacore linked a pull request Jun 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant