Skip to content

Remove inaccurate statement about the insertion mode and CDATA sections#12658

Merged
annevk merged 1 commit into
whatwg:mainfrom
sirreal:sirreal/correct-cdata-insertion-mode
Jul 17, 2026
Merged

Remove inaccurate statement about the insertion mode and CDATA sections#12658
annevk merged 1 commit into
whatwg:mainfrom
sirreal:sirreal/correct-cdata-insertion-mode

Conversation

@sirreal

@sirreal sirreal commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The explanation of the insertion mode includes this inaccurate line (bold mine):

The insertion mode affects how tokens are processed and whether CDATA sections are supported.

CDATA section handling depends on the adjusted current node, not the insertion mode:

"[CDATA["
Consume those characters. If there is an adjusted current node and it is not an element in the HTML namespace, then switch to the CDATA section state. Otherwise, this is a cdata-in-html-content parse error. Create a comment token whose data is "[CDATA[". Switch to the bogus comment state.

If CDATA sections are not handled as bogus comments, they emit character tokens.

See #4016 (comment).


/parsing.html ( diff )

@sirreal

sirreal commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

From #4015:

https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign is not mentioned, although it is where CDATA sections are supported. If in foreign content is not an insertion mode, then the insertion mode doesn't affect whether CDATA sections are supported...

@annevk
annevk merged commit 9377fd6 into whatwg:main Jul 17, 2026
2 checks passed
annevk added a commit that referenced this pull request Jul 18, 2026
The rules for parsing tokens in foreign content are selected per token by
the tree construction dispatcher and leave the insertion mode unchanged.

Follow-up to #12658. Fixes #4015.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants