Skip to content

null textContent value for DocumentFragment #231

Open
@davecardwell

Description

@davecardwell

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);

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