mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
676bf1c7fd
+ Settings drawer could not be closed when clicking above or below its container. This has been fixed by changin the logic used for determining if the click was inside/outside of the Settings drawer. + Added DOM utility to compensate for the limitations of JQuery contains...
29 lines
806 B
JavaScript
29 lines
806 B
JavaScript
(function () {
|
|
var ns = $.namespace('pskl.utils');
|
|
|
|
ns.Dom = {
|
|
/**
|
|
* Check if a given HTML element is nested inside another
|
|
* @param {HTMLElement} node Element to test
|
|
* @param {HTMLElement} parent Potential Ancestor for node
|
|
* @param {Boolean} excludeParent set to true if the parent should be excluded from potential matches
|
|
* @return {Boolean} true if parent was found amongst the parentNode chain of node
|
|
*/
|
|
isParent : function (node, parent, excludeParent) {
|
|
if (node && parent) {
|
|
|
|
if (excludeParent) {
|
|
node = node.parentNode;
|
|
}
|
|
|
|
while (node) {
|
|
if (node === parent) {
|
|
return true;
|
|
}
|
|
node = node.parentNode;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
})(); |