mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Added domContains()
Lots of event handlers need this
This commit is contained in:
parent
b1b893c692
commit
e17772c830
10
js/Utils.js
10
js/Utils.js
@ -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);
|
||||
};
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user