From 8dc1f66d93fc818bd45902afd32d248709b82b10 Mon Sep 17 00:00:00 2001 From: Tim Nieradzik Date: Tue, 27 Feb 2018 00:08:43 +0100 Subject: [PATCH] Node: Add contains() See also: - https://developer.mozilla.org/en-US/docs/Web/API/Node/contains - https://dom.spec.whatwg.org/#dom-node-contains-other-other --- src/main/scala/org/scalajs/dom/raw/lib.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/scala/org/scalajs/dom/raw/lib.scala b/src/main/scala/org/scalajs/dom/raw/lib.scala index ae3dc4cf5..e5f697073 100644 --- a/src/main/scala/org/scalajs/dom/raw/lib.scala +++ b/src/main/scala/org/scalajs/dom/raw/lib.scala @@ -1170,6 +1170,15 @@ abstract class Node extends EventTarget { */ def isSameNode(other: Node): Boolean = js.native + /** + * Returns a Boolean value indicating whether a node is a descendant of a + * given node, i.e. the node itself, one of its direct children (childNodes), + * one of the children's direct children, and so on. + * + * MDN + */ + def contains(otherNode: Node): Boolean = js.native + /** * hasAttributes returns a boolean value of true or false, indicating if the current * element has any attributes or not.