Bug
1857113 [wpt PR 42352] - Enable declarative DOM Parts within template innerHTML setting, a=testonly
Automatic update from web-platform-tests
Enable declarative DOM Parts within template innerHTML setting
This CL allows this snippet to work:
const wrapper = document.createElement('template');
wrapper.parseparts = true;
wrapper.innerHTML = '<h1>{{#}}content{{/}}</h1>';
wrapper.content.getPartRoot().getParts === 1;
To achieve this, several things had to change:
- Element::SetInnerHTMLInternal() has to detect that the context
element is a `<template>` with the `parseparts` attribute, and
swap the parts list from the parser-created document fragment
over to the template's content document fragment.
- The HTMLElementStack's code to check for `parseparts` needs to
check a new state enum, which allows:
1. always parsing parts - used for innerHTML on `<template
parseparts>`,
2. never parsing parts - used on any other innerHTML, or
3. watching for the parseparts attribute within content - used
for main document parsing
- HTMLDocumentParser::ParseDocumentFragment() needs to also detect
the `<template parseparts>` context element, and forward that
bit over to the HTMLElementStack, via HTMLTreeBuilder and
HTMLConstructionSite.
- The HTMLDocumentParserFastPath needs to be updated to notice
the `<template parseparts>` and bail (at least for now).
Bug:
1453291
Change-Id: I3eadba790b6bb197ed7a55017a14e3af942de519
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/
4914333
Commit-Queue: Mason Freed <masonf@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#
1205926}
--
wpt-commits:
5cdb13a85ebc46aca9d65ceff121acd99db502c7
wpt-pr: 42352