jquery / jquery/sizzle

Throw a better error when documentElement is missing

Open
#458 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.3k
Forks
927
PR merge metrics
No merged PRs in 30d

Description

PR #439 made Sizzle crash earlier on a documentElement-missing document. However, we want selection to work on nodes inside of a <template> element for which ownerDocument will point to a document fragment with a null documentElement. As @gibson042 said in #452:

We discussed in-meeting and had rough consensus that the right behavior was to stop at a disconnected fragment but to traverse up through a fragment's <template> host when one exists. But unfortunately, it seems difficult and maybe impossible to differentiate the two. My ideal change would instead be to tolerate null documentElement, but more changes will be required for that.

Contributor guide

Open the contributing guide

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 reviewing PR #439 and the discussion referenced from #452 to understand the existing documentElement-missing crash and the proposed fragment behavior. Investigate Sizzle selection for nodes inside a element and define completion against the stated goal of tolerating a null documentElement without incorrectly traversing disconnected fragments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.