[wpt-sync] Sync PR 22709 - Adds ability to clear out assigned nodes to slot when slot is removed from shadow root.
Categories
(Core :: DOM: Core & HTML, task, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 22709 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/22709
Details from upstream follow.
Yu Han <yuzhehan@chromium.org> wrote:
Adds ability to clear out assigned nodes to slot when slot is removed from shadow root.
Prior to this CL, when a slot with imperatively assigned nodes is
removed from the its shadow root, assignment recalc is deferred until
an API (Slot.assignedNodes, Node.assignedSlot) or a LifeCycleUpdate
triggers the recalc. If no assignment recalc is triggered and the
slot is added back to its original shadow root, its imperatively
assigned nodes will reappear. This is an unwanted side effect
because if an assignment recalc is trigger before slot is added back,
its assigned nodes will be cleared.This CL fixes this side effect by clearing a slot's imperatively
assigned nodes whenever it's removed from its parent node. Thus,
regardless of whether a recalc is trigger before the slot is added back
or not, the end result is that the slot's assigned nodes are empty.Note: With this CL, even moving the slot inside it's shadow root will
clear out its imperatively assigned nodes. See example:
host
---sr
--s1
--s2
--c1s2.assign([c1]);
sr.insertBefore(s2, s1);
assert_array_equals(s2.assignedNodes(), []);I believe this is correct behavior. The output should be the same as
removed = sr.removeChild(s2)
sr.appendChild(removed);The behavior is consistent for a slot inside a shadow root with
manual slot assignment. Whether the slot is moved or removed/appended
inside its containing shadow root, the result is its assigned nodes
are cleared.Bug:869308
Change-Id: Ie1247684b77d5c4b8e5f113421807c0c187224f0Reviewed-on: https://chromium-review.googlesource.com/2135371
WPT-Export-Revision: 1fae0e5c9532117499e9d2166188d076db48ddcf
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
Comment 4•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b299d13d01d5
https://hg.mozilla.org/mozilla-central/rev/c08f0a2a070e
Description
•