Skip to content

Add HTML processing instruction tokenizer states - #130

Open
hjanuschka wants to merge 1 commit into
validator:masterfrom
hjanuschka:processing-instructions
Open

hjanuschka wants to merge 1 commit into
validator:masterfrom
hjanuschka:processing-instructions

Conversation

@hjanuschka

Copy link
Copy Markdown

implements the PI tokenizer states from whatwg/html#11818 (declarative partial updates / , mozilla bug 2053472) behind Tokenizer.setProcessingInstructionsEnabled(), default false so nothing changes for existing users.

invalid and disallowed targets fall back to the bogus comment state with the legacy comment data, EOF inside a PI emits nothing, and the spec's named parse errors are wired through ErrorReportingTokenizer. the DOM, SAX and XOM tree builders create the matching PI nodes.

the Gecko side re-translates from this and is staged behind dom.template_for.enabled (https://phabricator.services.mozilla.com/D331109), so naming or shape feedback here lands there automatically.

Implements the processing instruction states added to the HTML Standard
by whatwg/html#11818 for the declarative partial updates proposal,
behind a new Tokenizer.setProcessingInstructionsEnabled() switch that
defaults to false so existing behavior is unchanged.

When enabled, <? in the tag open state starts a processing instruction
instead of a bogus comment. Valid targets produce a new TokenHandler
processingInstruction() token with the target and data; invalid first
characters, invalid target characters, and the disallowed "xml" and
"xml-stylesheet" targets fall back to the bogus comment state with the
legacy comment data. A processing instruction truncated by EOF emits
nothing, per the spec.

The TreeBuilder handles the token like a comment token for insertion
purposes, and the DOM, SAX and XOM tree builders create the
corresponding processing instruction nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant