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);
The
.textContent
attribute of aDocumentFragment
—such as the one returned by a<template>
’s.content
attribute—isnull
.