Revert style/dom_apis changes

This commit is contained in:
Fernando Jiménez Moreno 2019-03-07 13:40:34 +01:00
parent bdd2f32c0f
commit 5be6779f9a

View file

@ -241,11 +241,10 @@ where
} }
if root.as_shadow_root().is_some() { if root.as_shadow_root().is_some() {
debug_assert!(element.as_node().is_in_document(), "Not connected?");
debug_assert_eq!( debug_assert_eq!(
element.containing_shadow().unwrap().as_node(), element.containing_shadow().unwrap().as_node(),
root, root,
"Where did this element come from?" "Not connected?"
); );
return true; return true;
} }
@ -277,17 +276,17 @@ where
} }
if root.is_in_document() { if root.is_in_document() {
if let Some(shadow) = root.as_shadow_root() {
return shadow.elements_with_id(id);
}
if let Some(shadow) = root.as_element().and_then(|e| e.containing_shadow()) {
return shadow.elements_with_id(id);
}
return root.owner_doc().elements_with_id(id); return root.owner_doc().elements_with_id(id);
} }
if let Some(shadow) = root.as_shadow_root() {
return shadow.elements_with_id(id);
}
if let Some(shadow) = root.as_element().and_then(|e| e.containing_shadow()) {
return shadow.elements_with_id(id);
}
Err(()) Err(())
} }