mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Throw HierarchyRequest error for Attr in pre-insert and replacechild
This commit is contained in:
parent
9acb9cc5cf
commit
0f65bbd296
3 changed files with 7 additions and 9 deletions
|
@ -1872,8 +1872,7 @@ impl Node {
|
||||||
NodeTypeId::Element(_) |
|
NodeTypeId::Element(_) |
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) |
|
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) |
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => (),
|
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => (),
|
||||||
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
|
NodeTypeId::Document(_) | NodeTypeId::Attr => return Err(Error::HierarchyRequest),
|
||||||
NodeTypeId::Attr => unreachable!(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
|
@ -1942,8 +1941,9 @@ impl Node {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NodeTypeId::CharacterData(_) => (),
|
NodeTypeId::CharacterData(_) => (),
|
||||||
NodeTypeId::Document(_) => unreachable!(),
|
// Because Document and Attr should already throw `HierarchyRequest`
|
||||||
NodeTypeId::Attr => unreachable!(),
|
// error, both of them are unreachable here.
|
||||||
|
NodeTypeId::Document(_) | NodeTypeId::Attr => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -2628,7 +2628,7 @@ impl NodeMethods for Node {
|
||||||
NodeTypeId::DocumentType if !self.is::<Document>() => {
|
NodeTypeId::DocumentType if !self.is::<Document>() => {
|
||||||
return Err(Error::HierarchyRequest);
|
return Err(Error::HierarchyRequest);
|
||||||
},
|
},
|
||||||
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
|
NodeTypeId::Document(_) | NodeTypeId::Attr => return Err(Error::HierarchyRequest),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2679,6 +2679,8 @@ impl NodeMethods for Node {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NodeTypeId::CharacterData(..) => (),
|
NodeTypeId::CharacterData(..) => (),
|
||||||
|
// Because Document and Attr should already throw `HierarchyRequest`
|
||||||
|
// error, both of them are unreachable here.
|
||||||
NodeTypeId::Document(_) => unreachable!(),
|
NodeTypeId::Document(_) => unreachable!(),
|
||||||
NodeTypeId::Attr => unreachable!(),
|
NodeTypeId::Attr => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[attributes-are-nodes.html]
|
|
||||||
expected: CRASH
|
|
|
@ -1,2 +0,0 @@
|
||||||
[attributes-are-nodes.html]
|
|
||||||
expected: CRASH
|
|
Loading…
Add table
Add a link
Reference in a new issue