mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/DOM: Stop early-out of assigning slottables when root is a slot
This would happen for example when removing a slot element from the DOM, in which case it would keep its old list of assigned slottables even though it now has none. Fixes a couple of WPT tests.
This commit is contained in:
parent
4f4e94dc9c
commit
91e73ecde1
Notes:
github-actions[bot]
2025-11-26 08:54:21 +00:00
Author: https://github.com/AtkinsSJ
Commit: 91e73ecde1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6931
Reviewed-by: https://github.com/gmta ✅
3 changed files with 6 additions and 8 deletions
|
|
@ -230,10 +230,10 @@ void assign_slottables_for_a_tree(GC::Ref<Node> root)
|
|||
// AD-HOC: This method iterates over the root's entire subtree. That iteration does nothing if the root is not a
|
||||
// shadow root (see `find_slottables`). This iteration can be very expensive as the HTML parser inserts
|
||||
// nodes, especially on sites with many elements. So we skip it if we know it's going to be a no-op anyways.
|
||||
if (!root->is_shadow_root())
|
||||
if (!root->is_shadow_root() && !root->is_html_slot_element())
|
||||
return;
|
||||
|
||||
// To assign slottables for a tree, given a node root, run assign slottables for each slot slot in root’s inclusive
|
||||
// To assign slottables for a tree, given a node root, run assign slottables for each slot of root’s inclusive
|
||||
// descendants, in tree order.
|
||||
root->for_each_in_inclusive_subtree_of_type<HTML::HTMLSlotElement>([](auto& slot) {
|
||||
assign_slottables(slot);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
|||
|
||||
Found 13 tests
|
||||
|
||||
12 Pass
|
||||
1 Fail
|
||||
13 Pass
|
||||
Pass Slots fallback: Basic.
|
||||
Pass Slots fallback: Basic, elements only.
|
||||
Pass Slots fallback: Slots in Slots.
|
||||
|
|
@ -16,4 +15,4 @@ Pass Slots fallback: Mutation. Append fallback contents.
|
|||
Pass Slots fallback: Mutation. Remove fallback contents.
|
||||
Pass Slots fallback: Mutation. Assign a node to a slot so that fallback contens are no longer used.
|
||||
Pass Slots fallback: Mutation. Remove an assigned node from a slot so that fallback contens will be used.
|
||||
Fail Slots fallback: Mutation. Remove a slot which is a fallback content of another slot.
|
||||
Pass Slots fallback: Mutation. Remove a slot which is a fallback content of another slot.
|
||||
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
|||
|
||||
Found 26 tests
|
||||
|
||||
25 Pass
|
||||
1 Fail
|
||||
26 Pass
|
||||
Pass Slots: Basic.
|
||||
Pass Slots: Basic, elements only.
|
||||
Pass Slots: Slots in closed.
|
||||
|
|
@ -27,6 +26,6 @@ Pass Slots: Mutation: Change slot= attribute 3.
|
|||
Pass Slots: Mutation: Remove a child.
|
||||
Pass Slots: Mutation: Add a slot: after.
|
||||
Pass Slots: Mutation: Add a slot: before.
|
||||
Fail Slots: Mutation: Remove a slot.
|
||||
Pass Slots: Mutation: Remove a slot.
|
||||
Pass Slots: Mutation: Change slot name= attribute.
|
||||
Pass Slots: Mutation: Change slot slot= attribute.
|
||||
Loading…
Add table
Add a link
Reference in a new issue