fix dom parsing issue (#1365)

This commit is contained in:
LawyZheng
2024-12-11 00:05:16 +08:00
committed by GitHub
parent 761a21eaaf
commit 583075899f

View File

@@ -787,6 +787,10 @@ const isReactSelectDropdown = (element) => {
}; };
function hasNgAttribute(element) { function hasNgAttribute(element) {
if (!element.attributes[Symbol.iterator]) {
return false;
}
for (let attr of element.attributes) { for (let attr of element.attributes) {
if (attr.name.startsWith("ng-")) { if (attr.name.startsWith("ng-")) {
return true; return true;
@@ -1057,6 +1061,7 @@ function buildElementObject(frame, element, interactable, purgeable = false) {
element.setAttribute("unique_id", element_id); element.setAttribute("unique_id", element_id);
const attrs = {}; const attrs = {};
if (element.attributes[Symbol.iterator]) {
for (const attr of element.attributes) { for (const attr of element.attributes) {
var attrValue = attr.value; var attrValue = attr.value;
if ( if (
@@ -1079,6 +1084,11 @@ function buildElementObject(frame, element, interactable, purgeable = false) {
} }
attrs[attr.name] = attrValue; attrs[attr.name] = attrValue;
} }
} else {
console.warn(
"element.attributes is not iterable. element_id=" + element_id,
);
}
if ( if (
checkDisabledFromStyle(element) && checkDisabledFromStyle(element) &&