Use "slot" attribute for slottable name (#35191)

* Implement Element::slot attribute

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Simplify slottable name update

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-01-29 13:50:03 +01:00 committed by GitHub
parent c633ca1cde
commit f6d1b30e97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 18 additions and 98 deletions

View file

@ -2241,6 +2241,12 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
.or_init(|| DOMTokenList::new(self, &local_name!("class"), None))
}
// https://dom.spec.whatwg.org/#dom-element-slot
make_getter!(Slot, "slot");
// https://dom.spec.whatwg.org/#dom-element-slot
make_setter!(SetSlot, "slot");
// https://dom.spec.whatwg.org/#dom-element-attributes
fn Attributes(&self) -> DomRoot<NamedNodeMap> {
self.attr_list
@ -3666,7 +3672,12 @@ impl VirtualMethods for Element {
// Update slottable data
let cx = GlobalScope::get_cx();
rooted!(in(*cx) let slottable = Slottable::Element(Dom::from_ref(self)));
slottable.update_slot_name(attr, mutation, CanGc::note())
// Slottable name change steps from https://dom.spec.whatwg.org/#light-tree-slotables
if let Some(assigned_slot) = slottable.assigned_slot() {
assigned_slot.assign_slottables();
}
slottable.assign_a_slot();
},
_ => {
// FIXME(emilio): This is pretty dubious, and should be done in