mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Auto merge of #10761 - amarant:Node-isSameNode, r=Ms2ger
Implements Node::isSameNode Fixes #10746 I adapted the tests from dom/nodes/Node-isEqualNode.html should I also add ones for xhtml too like here : dom/nodes/Node-isEqualNode-xhtml.xhtml ? <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10761) <!-- Reviewable:end -->
This commit is contained in:
commit
4f05ea73fe
5 changed files with 116 additions and 52 deletions
|
@ -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 {
|
||||
|
|
|
@ -58,6 +58,8 @@ interface Node : EventTarget {
|
|||
Node cloneNode(optional boolean deep = false);
|
||||
[Pure]
|
||||
boolean isEqualNode(Node? node);
|
||||
[Pure]
|
||||
boolean isSameNode(Node? otherNode); // historical alias of ===
|
||||
|
||||
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
|
||||
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue