Added domContains()

Lots of event handlers need this
print-window-tiddler
Jeremy Ruston 2012-03-07 17:40:59 +00:00
rodzic b1b893c692
commit e17772c830
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -228,4 +228,14 @@ utils.nextTick = function(fn) {
}
};
/*
Determines whether element 'a' contains element 'b'
Code thanks to John Resig, http://ejohn.org/blog/comparing-document-position/
*/
utils.domContains = function(a,b) {
return a.contains ?
a != b && a.contains(b) :
!!(a.compareDocumentPosition(b) & 16);
};
})();