1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 23:40:45 +00:00

Added domContains()

Lots of event handlers need this
This commit is contained in:
Jeremy Ruston 2012-03-07 17:40:59 +00:00
parent b1b893c692
commit e17772c830

View File

@ -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);
};
})();