Skip to content

Reset frameset-ok when the body element is inserted implicitly - #12908

Merged
annevk merged 1 commit into
mainfrom
frameset-ok-implicit-body
Sep 7, 2026
Merged

annevk merged 1 commit into
mainfrom
frameset-ok-implicit-body

Conversation

@annevk

@annevk annevk commented Sep 5, 2026

Copy link
Copy Markdown
Member

Reset frameset-ok when the body element is inserted implicitly

The <template> start tag sets the frameset-ok flag to "not ok" in the
"in head" insertion mode and nothing ever sets it back, so the standard
says the <frameset> is ignored in
<head><template></template></head><p><frameset>, whereas engines create
a frameset document. The same goes for anything inside a head-level
template that sets the flag, such as <template>x</template><p><frameset>.

The "after head" insertion mode's "anything else" entry now sets the flag
back to "ok" when it inserts the body element. Nothing seen up to that
point can have been body content; before template there was no way to set
the flag to "not ok" while still in the head, which is presumably why this
was missed.

A <frameset> inside a template stays ignored. The flag is read in exactly
one place, the <frameset> start tag in the "in body" insertion mode, and
it can now only be reset at the moment the body element is inserted. A
template element can never be on the stack of open elements at that moment,
so whenever a template is open and the second element on the stack of open
elements is a body element the flag is still "not ok".

Tests: web-platform-tests/wpt#62485

Fixes #3178.


(See WHATWG Working Mode: Changes for more details.)

The `<template>` start tag sets the frameset-ok flag to "not ok" in the
"in head" insertion mode and nothing ever sets it back, so the standard
says the `<frameset>` is ignored in
`<head><template></template></head><p><frameset>`, whereas engines create
a frameset document. The same goes for anything inside a head-level
template that sets the flag, such as `<template>x</template><p><frameset>`.

The "after head" insertion mode's "anything else" entry now sets the flag
back to "ok" when it inserts the body element. Nothing seen up to that
point can have been body content; before template there was no way to set
the flag to "not ok" while still in the head, which is presumably why this
was missed.

A `<frameset>` inside a template stays ignored. The flag is read in exactly
one place, the `<frameset>` start tag in the "in body" insertion mode, and
it can now only be reset at the moment the body element is inserted. A
template element can never be on the stack of open elements at that moment,
so whenever a template is open and the second element on the stack of open
elements is a body element the flag is still "not ok".

Tests: web-platform-tests/wpt#62485

Fixes #3178.
@annevk annevk added the topic: parser The HTML parser and serializer, including fragment parsing and character references label Sep 5, 2026
@annevk
annevk requested review from noamr and zcorpan September 5, 2026 12:22
@annevk
annevk merged commit 83c0aa8 into main Sep 7, 2026
2 checks passed
@annevk
annevk deleted the frameset-ok-implicit-body branch September 7, 2026 13:18
sirreal added a commit to sirreal/wordpress-develop that referenced this pull request Sep 16, 2026
whatwg/html#12908 (merged 2026-09-07) resets the frameset-ok flag to "ok" when the "after head" insertion mode inserts the BODY element implicitly. The HTML Processor does not do that yet, so `template/line0606` and `template/line0619` ignore the FRAMESET start tag where the fixture expects a frameset document.
lexborisov added a commit to TimWolla/lexbor that referenced this pull request Sep 26, 2026
A template start tag in the "in head" insertion mode set the frameset-ok
flag to "not ok", and nothing set it back. As a result, the frameset
start tag was ignored in <head><template></template></head><p><frameset>,
while the specification and browsers create a frameset document.

whatwg/html#12908
txgk added a commit to gumbo-parser/gumbo-parser that referenced this pull request Sep 27, 2026
fixes 6 new test cases from WPT scenarios added in the last commit

whatwg/html#12908
whatwg/html#12911
takahashim pushed a commit to takahashim/makiri that referenced this pull request Oct 18, 2026
The "after head" anything-else branch sets frameset-ok back to "ok", as
whatwg/html#12908 added and Lexbor lacks. WPT template.dat #44-#46 now pass
through the port; they stay listed for Lexbor's DOM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BMxN4Q2YABFU7rja1q8bhg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: parser The HTML parser and serializer, including fragment parsing and character references

Development

Successfully merging this pull request may close these issues.

Should <head><template> set frameset-ok flag to "not ok"?

2 participants