fix domutils potential bugs (#767)
This commit is contained in:
@@ -1639,7 +1639,7 @@ if (window.globalDomDepthMap === undefined) {
|
|||||||
|
|
||||||
function isClassNameIncludesHidden(className) {
|
function isClassNameIncludesHidden(className) {
|
||||||
// some hidden elements are with the classname like `class="select-items select-hide"`
|
// some hidden elements are with the classname like `class="select-items select-hide"`
|
||||||
return className.includes("hide");
|
return className.toLowerCase().includes("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
function addIncrementalNodeToMap(parentNode, childrenNode) {
|
function addIncrementalNodeToMap(parentNode, childrenNode) {
|
||||||
@@ -1669,7 +1669,7 @@ if (window.globalObserverForDOMIncrement === undefined) {
|
|||||||
if (mutation.type === "attributes") {
|
if (mutation.type === "attributes") {
|
||||||
if (mutation.attributeName === "style") {
|
if (mutation.attributeName === "style") {
|
||||||
// TODO: need to confirm that elemnent is hidden previously
|
// TODO: need to confirm that elemnent is hidden previously
|
||||||
node = mutation.target;
|
const node = mutation.target;
|
||||||
if (node.nodeType === Node.TEXT_NODE) continue;
|
if (node.nodeType === Node.TEXT_NODE) continue;
|
||||||
const newStyle = window.getComputedStyle(node);
|
const newStyle = window.getComputedStyle(node);
|
||||||
const newDisplay = newStyle.display;
|
const newDisplay = newStyle.display;
|
||||||
@@ -1682,7 +1682,7 @@ if (window.globalObserverForDOMIncrement === undefined) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mutation.attributeName === "class") {
|
if (mutation.attributeName === "class") {
|
||||||
node = mutation.target;
|
const node = mutation.target;
|
||||||
if (
|
if (
|
||||||
!mutation.oldValue ||
|
!mutation.oldValue ||
|
||||||
!isClassNameIncludesHidden(mutation.oldValue)
|
!isClassNameIncludesHidden(mutation.oldValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user