Implements Node::isSameNode

Fixes #10746

Adapted the tests from dom/nodes/Node-isEqualNode.html
This commit is contained in:
Arnaud Marant 2016-04-20 22:23:27 +02:00
parent 305c283602
commit ed42cc72a4
5 changed files with 116 additions and 52 deletions

View file

@ -2230,6 +2230,14 @@ impl NodeMethods for Node {
}
}
// https://dom.spec.whatwg.org/#dom-node-issamenode
fn IsSameNode(&self, otherNode: Option<&Node>) -> bool {
match otherNode {
Some(node) => self == node,
None => false,
}
}
// https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
fn CompareDocumentPosition(&self, other: &Node) -> u16 {
if self == other {