WebReflection / WebReflection/linkedom

null textContent value for DocumentFragment

Open
#231 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.1k
Forks
104
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the DocumentFragment textContent implementation and compare it with the browser behavior shown in the issue’s template.content example. Done means template.content.textContent returns the fragment’s text rather than null, while the demonstrated behavior remains consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.