Skip to content

Commit

Permalink
When using contains, compare the parent if not an element.
Browse files Browse the repository at this point in the history
One of the "using" tests failed in PhantomJS because PhantomJS doesn't support "contains" for comments.
  • Loading branch information
mbest committed Nov 20, 2015
1 parent f07616a commit 7785a44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ ko.utils = (function () {
if (node.nodeType === 11)
return false; // Fixes issue #1162 - can't use node.contains for document fragments on IE8
if (containedByNode.contains)
return containedByNode.contains(node.nodeType === 3 ? node.parentNode : node);
return containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node);
if (containedByNode.compareDocumentPosition)
return (containedByNode.compareDocumentPosition(node) & 16) == 16;
while (node && node != containedByNode) {
Expand Down

0 comments on commit 7785a44

Please sign in to comment.