w3c / w3c/DOM-Parsing

createContextualFragment() should do adopt node or some such

Open
#65 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
28
Forks
14
Avg merge
3h 10m
Merged PRs (30d)
1

Description

The HTML fragment parsing algorithm creates its own dummy document. Which means that

document.createRange().createContextualFragment(`<img src=x onerror=alert(1)>`)

should technically not alert as things are currently defined (images are only fetched in active documents). However, it does. In all browsers. And if you check the node document of the returned fragment it will match document, which is an active document.

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 reading the HTML fragment parsing algorithm and compare its dummy-document handling with the reported createContextualFragment() behavior. Confirm the returned fragment's node document and image-fetching behavior, then determine the precise specification change needed to resolve the discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.