Bug
1852608 [wpt PR 41826] - Add {{#}} & {{/}} syntax for ChildNodeParts, a=testonly
Automatic update from web-platform-tests
Add {{#}} & {{/}} syntax for ChildNodeParts
This CL enables this syntax:
<span parseparts>
before {{#}} inside {{/}} after
</span>
The above snippet will now replace the {{}} parts with empty comment
nodes, and a `ChildNodePart` will be attached that surrounds "inside".
Note the new `parseparts` attribute, which is the opt-in for this
new behavior (in addition to the required runtime flag being enabled
of course).
The implementation looks like this:
- The `HTMLElementStack` gets a new `parse_parts_count_` which keeps
a count of the `parseparts` attributes seen on elements. Currently,
`parseparts` is strictly an opt-in, and subsequent `parseparts`
can't be used to somehow opt back out.
- The `HTMLTreeBuilder` relays to the `HTMLTokenizer` whether or not
we're currently inside a `parseparts` scope.
- The `HTMLToken` and `AtomicHTMLToken` classes get a new token type,
`kDOMPart` which is used for the ChildNodePart node endpoint
markers. These have a DOMPartTokenType which is either
`kChildNodePartStart` or `kChildNodePartEnd`.
- The `HTMLTokenizer` looks for `{{#}}` and `{{/}}` in the data
state, and if detected, switches to two new tokenizer states,
`kChildNodePartStartState` and `kChildNodePartEndState`. Those both
immediately emit a `kDOMPart` token and return to the DATA state.
- The `HTMLTreeBuilder`, when it finds a `kDOMPart` token, forwards
it to `HTMLConstructionSite::InsertDOMPart()`.
- `HTMLConstructionSite::InsertDOMPart()` adds the ChildNodePart via
the existing mechanism.
I split the one test file into multiple, and basically copy/pasted
the "old" declarative style into a new test. Eventually/soon I will
delete the old style (e.g. `<?child-node-part?>`) syntax support, and
the old test with it.
NodeParts aren't yet supported.
Bug:
1453291
Change-Id: I9496685383575f735d48410a50da5593ed027820
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/
4844130
Reviewed-by: David Baron <dbaron@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#
1194954}
--
wpt-commits:
2a7dfe2c61e56614d7dac52149015230f16d536d
wpt-pr: 41826