Repository navigation
Conversation
… elements When the sanitizer removes a formatting element, the adoption agency algorithm can reparent furthestBlock (and the formatting elements cloned above it) out of the removed element's inert subtree into the live tree. These tests pin down what happens then, per whatwg/html#13093: - elements that are moved into a target with a scoped custom element registry pick up that registry, so custom elements parsed into them afterwards are created with it; - children of furthestBlock that end up below a removed clone of the formatting element never become connected, so no custom element reactions run for them and their resources are not fetched; - inner-loop clones created in template contents have a null registry like everything else in there, and are not upgraded.
|
Review-and-fix pass over the current head (63815b4), together with whatwg/html#13214. Questions / follow-ups
FindingsNo test changes were needed. I traced each of the six tests through the algorithm on the spec PR branch and the expected values follow from it: tests 2 and 3 need the registry propagation step before |
AI feedbackReviewed at 575dc99. Suggestions
|
…ermediate element test
|
Fixed in |
otherdaniel
left a comment
There was a problem hiding this comment.
Thanks! This all looks good to me, but admittedly I'm having a hard time thinking through the edge cases here. :|
Tests for whatwg/html#13214, which fixes how the adoption agency algorithm creates and reparents elements when the parser's sanitizer configuration removes a formatting element (whatwg/html#13093).
The new
sanitizer-api/sanitizer-adoption-agency-removed-elements.htmlpins down, whenfurthestBlockis moved out of a removed formatting element:setHTMLUnsafe()target applies tofurthestBlock, to its deeper descendants, and to elements parsed into it afterwards, just as it does when the formatting element is kept (tests 1–3);furthestBlock's children never become connected: a customized built-in element in there gets noconnectedCallback, and animgsends no request, while the adoptedfurthestBlockitself still works (test 4);template, the reparented elements and inner-loop clones keep a null registry and the template contents' document, and that a clone whose token has anisattribute survives with its children (tests 5–6).Chrome Canary and Firefox Nightly fail tests 2 and 3 (neither propagates the scoped registry); Chrome Canary also fails test 6 because it drops the inner-loop clone of a formatting element with an
isattribute, independently of the sanitizer.