mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Ensure Element ID modifications inside disconnected shadow roots are registered (#34834)
* Add test for modifying element IDs in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Register element ID modifications inside disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Don't crash when registering named elements in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix test title 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:
parent
1ab55e6b11
commit
75a22cfe2e
4 changed files with 30 additions and 2 deletions
|
@ -303,7 +303,7 @@ impl DocumentOrShadowRoot {
|
|||
root: DomRoot<Node>,
|
||||
) {
|
||||
debug!("Adding named element {:p}: {:p} id={}", self, element, id);
|
||||
assert!(element.upcast::<Node>().is_connected());
|
||||
assert!(element.upcast::<Node>().is_connected_to_tree());
|
||||
assert!(!id.is_empty());
|
||||
let mut id_map = id_map.borrow_mut();
|
||||
let elements = id_map.entry(id.clone()).or_default();
|
||||
|
|
|
@ -3510,8 +3510,9 @@ impl VirtualMethods for Element {
|
|||
None
|
||||
}
|
||||
});
|
||||
|
||||
let containing_shadow_root = self.containing_shadow_root();
|
||||
if node.is_connected() {
|
||||
if node.is_connected_to_tree() {
|
||||
let value = attr.value().as_atom().clone();
|
||||
match mutation {
|
||||
AttributeMutation::Set(old_value) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue