Skip to content

Instantly share code, notes, and snippets.

@zhuzhuaicoding
Created December 12, 2013 11:41
Show Gist options
  • Select an option

  • Save zhuzhuaicoding/7926756 to your computer and use it in GitHub Desktop.

Select an option

Save zhuzhuaicoding/7926756 to your computer and use it in GitHub Desktop.
STK.register("core.dom.contains", function (a) {
return function (a, b) {
if (a === b)return!1;
if (a.compareDocumentPosition)return(a.compareDocumentPosition(b) & 16) === 16;
if (a.contains && b.nodeType === 1)return a.contains(b);
while (b = b.parentNode)if (a === b)return!0;
return!1
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment