File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import {
31
31
capitalizeFirstLetter ,
32
32
getElementName ,
33
33
isDef ,
34
+ isElement ,
34
35
isolateUserCode ,
35
36
once ,
36
37
round ,
@@ -979,7 +980,7 @@ This version of <i>iframe-resizer</> can auto detect the most suitable ${type} c
979
980
}
980
981
981
982
function attachObservers ( ) {
982
- const nodeList = getAllElements ( document ) ( )
983
+ const nodeList = getAllElements ( document . documentElement ) ( )
983
984
984
985
log ( 'Attaching Observers' )
985
986
createMutationObserver ( mutationObserved )
@@ -1039,7 +1040,11 @@ This version of <i>iframe-resizer</> can auto detect the most suitable ${type} c
1039
1040
dimension . boundingClientRect ( ) ,
1040
1041
]
1041
1042
1042
- const getAllElements = ( element ) => ( ) => {
1043
+ const getAllElements = ( node ) => ( ) => {
1044
+ log ( 'node:' , node )
1045
+ log ( 'node type:' , node ?. nodeType )
1046
+ if ( ! isElement ( node ) ) return [ node ]
1047
+
1043
1048
const selector = [
1044
1049
'* ' ,
1045
1050
'not(head)' ,
@@ -1063,7 +1068,7 @@ This version of <i>iframe-resizer</> can auto detect the most suitable ${type} c
1063
1068
if ( hasIgnored )
1064
1069
selector . push ( `not([${ IGNORE_ATTR } ])` , `not([${ IGNORE_ATTR } ] *)` )
1065
1070
1066
- return [ element , ...element . querySelectorAll ( selector . join ( ':' ) ) ]
1071
+ return [ node , ...node . querySelectorAll ( selector . join ( ':' ) ) ]
1067
1072
}
1068
1073
1069
1074
function getOffsetSize ( getDimension ) {
Original file line number Diff line number Diff line change
1
+ export const isElement = ( node ) => node . nodeType === Node . ELEMENT_NODE
2
+
1
3
export const isNumber = ( value ) => ! Number . isNaN ( value )
2
4
3
5
export const isolateUserCode = ( func , ...val ) =>
You can’t perform that action at this time.
0 commit comments