@@ -15,28 +15,39 @@ function supportsPixelatedImage() {
15
15
if ( _supportsPixelated !== null ) { // only run the feature detection once
16
16
return _supportsPixelated ;
17
17
}
18
- if ( Lib . isIE ( ) || Lib . isSafari ( ) || Lib . isIOS ( ) ) {
19
- // NB. Safari passes the test below but the final rendering is not pixelated
20
- _supportsPixelated = false ;
21
- } else {
18
+
19
+ _supportsPixelated = false ;
20
+
21
+ // @see https://github.com/plotly/plotly.js/issues/6604
22
+ var unsupportedBrowser = Lib . isIE ( ) || Lib . isSafari ( ) || Lib . isIOS ( ) ;
23
+
24
+ if ( window . navigator . userAgent && ! unsupportedBrowser ) {
22
25
var declarations = Array . from ( constants . CSS_DECLARATIONS ) . reverse ( ) ;
23
- var supports = window . CSS && window . CSS . supports || window . supportsCSS ;
26
+
27
+ var supports = ( window . CSS && window . CSS . supports ) || window . supportsCSS ;
24
28
if ( typeof supports === 'function' ) {
25
29
_supportsPixelated = declarations . some ( function ( d ) {
26
30
return supports . apply ( null , d ) ;
27
31
} ) ;
28
32
} else {
29
- var image3 = Drawing . tester . append ( 'image' ) ;
33
+ var image3 = Drawing . tester . append ( 'image' )
34
+ . attr ( 'style' , constants . STYLE ) ;
35
+
30
36
var cStyles = window . getComputedStyle ( image3 . node ( ) ) ;
31
- image3 . attr ( 'style' , constants . STYLE ) ;
37
+ var imageRendering = cStyles . imageRendering ;
38
+
32
39
_supportsPixelated = declarations . some ( function ( d ) {
33
40
var value = d [ 1 ] ;
34
- return cStyles . imageRendering === value ||
35
- cStyles . imageRendering === value . toLowerCase ( ) ;
41
+ return (
42
+ imageRendering === value ||
43
+ imageRendering === value . toLowerCase ( )
44
+ ) ;
36
45
} ) ;
46
+
37
47
image3 . remove ( ) ;
38
48
}
39
49
}
50
+
40
51
return _supportsPixelated ;
41
52
}
42
53
0 commit comments