mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Partial ShadowRoot implementation of DocumentOrShadowRoot
This commit is contained in:
parent
18ae0fcbd6
commit
4304ee28dc
9 changed files with 161 additions and 54 deletions
|
@ -1560,7 +1560,9 @@ impl Node {
|
|||
) -> ErrorResult {
|
||||
// Step 1.
|
||||
match parent.type_id() {
|
||||
NodeTypeId::Document(_) | NodeTypeId::DocumentFragment(_) | NodeTypeId::Element(..) => (),
|
||||
NodeTypeId::Document(_) | NodeTypeId::DocumentFragment(_) | NodeTypeId::Element(..) => {
|
||||
()
|
||||
},
|
||||
_ => return Err(Error::HierarchyRequest),
|
||||
}
|
||||
|
||||
|
@ -2248,7 +2250,9 @@ impl NodeMethods for Node {
|
|||
fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible<DomRoot<Node>> {
|
||||
// Step 1.
|
||||
match self.type_id() {
|
||||
NodeTypeId::Document(_) | NodeTypeId::DocumentFragment(_) | NodeTypeId::Element(..) => (),
|
||||
NodeTypeId::Document(_) | NodeTypeId::DocumentFragment(_) | NodeTypeId::Element(..) => {
|
||||
()
|
||||
},
|
||||
_ => return Err(Error::HierarchyRequest),
|
||||
}
|
||||
|
||||
|
@ -2351,8 +2355,10 @@ impl NodeMethods for Node {
|
|||
|
||||
// Step 12.
|
||||
rooted_vec!(let mut nodes);
|
||||
let nodes = if node.type_id() == NodeTypeId::DocumentFragment(DocumentFragmentTypeId::DocumentFragment) ||
|
||||
node.type_id() == NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot) {
|
||||
let nodes = if node.type_id() ==
|
||||
NodeTypeId::DocumentFragment(DocumentFragmentTypeId::DocumentFragment) ||
|
||||
node.type_id() == NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot)
|
||||
{
|
||||
nodes.extend(node.children().map(|node| Dom::from_ref(&*node)));
|
||||
nodes.r()
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue