lemonadejs
Advanced tools
Comparing version 3.3.1 to 3.3.2
/** | ||
* Lemonadejs v3.3.0 (ESM build) | ||
* Lemonadejs v3.3.2 (ESM build) | ||
* | ||
@@ -132,2 +132,26 @@ * Website: https://lemonadejs.net | ||
/** | ||
* Check if a element is appended to the DOM or a shadowRoot | ||
* @param {HTMLElement} node | ||
* @return {boolean} | ||
*/ | ||
const contains = function(node) { | ||
while (node) { | ||
if (node === document.body) { | ||
return true; // Node is in main document | ||
} | ||
if (node.parentNode === null) { | ||
if (node.host) { | ||
node = node.host; // Traverse up through ShadowRoot | ||
} else { | ||
return false; // Detached node | ||
} | ||
} else { | ||
node = node.parentNode; // Traverse up through parentNode | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Process all methods queued from the ready property | ||
@@ -138,3 +162,3 @@ * @param {HTMLElement} e - check if the element is already in the DOM | ||
// Un-queue | ||
if (document.body.contains(e)) { | ||
if (contains(e)) { | ||
// Process ready elements | ||
@@ -141,0 +165,0 @@ unqueue('ready', function(q) { |
/** | ||
* Lemonadejs v3.3.0 | ||
* LemonadeJS v3.3.2 | ||
* | ||
@@ -143,2 +143,26 @@ * Website: https://lemonadejs.net | ||
/** | ||
* Check if a element is appended to the DOM or a shadowRoot | ||
* @param {HTMLElement} node | ||
* @return {boolean} | ||
*/ | ||
const contains = function(node) { | ||
while (node) { | ||
if (node === document.body) { | ||
return true; // Node is in main document | ||
} | ||
if (node.parentNode === null) { | ||
if (node.host) { | ||
node = node.host; // Traverse up through ShadowRoot | ||
} else { | ||
return false; // Detached node | ||
} | ||
} else { | ||
node = node.parentNode; // Traverse up through parentNode | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Process all methods queued from the ready property | ||
@@ -149,3 +173,3 @@ * @param {HTMLElement} e - check if the element is already in the DOM | ||
// Un-queue | ||
if (document.body.contains(e)) { | ||
if (contains(e)) { | ||
// Process ready elements | ||
@@ -152,0 +176,0 @@ unqueue('ready', function(q) { |
@@ -39,3 +39,3 @@ { | ||
"types": "dist/lemonade.d.ts", | ||
"version": "3.3.1" | ||
"version": "3.3.2" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84731
2053