From 9793abc61a1a1e5a58fcbc37d8a220c99e001754 Mon Sep 17 00:00:00 2001 From: straker Date: Fri, 14 Jul 2017 15:42:24 -0600 Subject: [PATCH] return false on undefined other node --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d01f0d9..58cfd63 100644 --- a/index.js +++ b/index.js @@ -17,5 +17,5 @@ module.exports = contains; */ function contains (node, other) { - return node === other || !!(node.compareDocumentPosition(other) & 16); + return other && (node === other || !!(node.compareDocumentPosition(other) & 16) ); }