Skip to content

Commit

Permalink
* Slick.contains(div, div) returns true to immitate Chrome/IE behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Feb 15, 2010
1 parent 8c0c435 commit b4b2ac0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Source/Slick/Slick.Finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,13 @@ authors:
local.setContains = function(root){

Slick.contains = local.contains = (root && root.contains) ? function(context, node){
return (context !== node && context.contains(node));
return context.contains(node);
} : (root && root.compareDocumentPosition) ? function(context, node){
return !!(context.compareDocumentPosition(node) & 16);
return context === node || !!(context.compareDocumentPosition(node) & 16);
} : function(context, node){
if (node) while ((node = node.parentNode))
if (node) do {
if (node === context) return true;
} while ((node = node.parentNode));
return false;
};

Expand Down

0 comments on commit b4b2ac0

Please sign in to comment.