1
1
import defineConfigurable from './defineConfigurable.js' ;
2
+ import getWindowOf from './getWindowOf.js' ;
2
3
import isBrowser from './isBrowser.js' ;
3
4
4
5
// Placeholder of an empty content rectangle.
@@ -84,7 +85,7 @@ function getHTMLElementContentRect(target) {
84
85
return emptyRect ;
85
86
}
86
87
87
- const styles = getComputedStyle ( target ) ;
88
+ const styles = getWindowOf ( target ) . getComputedStyle ( target ) ;
88
89
const paddings = getPaddings ( styles ) ;
89
90
const horizPad = paddings . left + paddings . right ;
90
91
const vertPad = paddings . top + paddings . bottom ;
@@ -152,15 +153,15 @@ function getHTMLElementContentRect(target) {
152
153
const isSVGGraphicsElement = ( ( ) => {
153
154
// Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
154
155
// interface.
155
- if ( typeof SVGGraphicsElement != 'undefined' ) {
156
- return target => target instanceof SVGGraphicsElement ;
156
+ if ( typeof SVGGraphicsElement !== 'undefined' ) {
157
+ return target => target instanceof getWindowOf ( target ) . SVGGraphicsElement ;
157
158
}
158
159
159
160
// If it's so, then check that element is at least an instance of the
160
161
// SVGElement and that it has the "getBBox" method.
161
162
// eslint-disable-next-line no-extra-parens
162
163
return target => (
163
- target instanceof SVGElement &&
164
+ target instanceof getWindowOf ( target ) . SVGElement &&
164
165
typeof target . getBBox === 'function'
165
166
) ;
166
167
} ) ( ) ;
@@ -172,7 +173,7 @@ const isSVGGraphicsElement = (() => {
172
173
* @returns {boolean }
173
174
*/
174
175
function isDocumentElement ( target ) {
175
- return target === document . documentElement ;
176
+ return target === getWindowOf ( target ) . document . documentElement ;
176
177
}
177
178
178
179
/**
@@ -202,7 +203,7 @@ export function getContentRect(target) {
202
203
*/
203
204
export function createReadOnlyRect ( { x, y, width, height} ) {
204
205
// If DOMRectReadOnly is available use it as a prototype for the rectangle.
205
- const Constr = typeof DOMRectReadOnly != 'undefined' ? DOMRectReadOnly : Object ;
206
+ const Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object ;
206
207
const rect = Object . create ( Constr . prototype ) ;
207
208
208
209
// Rectangle's properties are not writable and non-enumerable.
0 commit comments