File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ export function checkElementType(
5555 // Additional check for real DOM elements that might not have nodeType
5656 ( element . tagName && typeof element . tagName === "string" ) ||
5757 // Check if it has DOM element-like properties (fallback)
58- ( element . setAttribute && typeof element . setAttribute === "function" )
58+ ( element . setAttribute &&
59+ typeof element . setAttribute === "function" )
5960 )
6061 }
6162 if ( elementTypeName === "Text" ) {
@@ -81,23 +82,24 @@ export function checkElementType(
8182
8283 return false
8384 } )
84-
85+
8586 // If simplified check succeeds, return true
8687 if ( simplifiedResult ) {
8788 return true
8889 }
89-
90+
9091 // Fallback to DOM-based check if simplified check fails and element has ownerDocument
9192 if ( element . ownerDocument ) {
9293 return elementTypeNames . some (
9394 ( elementTypeName ) =>
94- typeof element ?. ownerDocument ?. defaultView ?. [ elementTypeName ] ===
95- "function" &&
95+ typeof element ?. ownerDocument ?. defaultView ?. [
96+ elementTypeName
97+ ] === "function" &&
9698 element instanceof
9799 element . ownerDocument . defaultView [ elementTypeName ] ,
98100 )
99101 }
100-
102+
101103 return false
102104 }
103105
@@ -111,4 +113,4 @@ export function checkElementType(
111113 element instanceof
112114 element . ownerDocument . defaultView [ elementTypeName ] ,
113115 )
114- }
116+ }
You can’t perform that action at this time.
0 commit comments