@@ -15,28 +15,39 @@ function supportsPixelatedImage() {
1515 if ( _supportsPixelated !== null ) { // only run the feature detection once
1616 return _supportsPixelated ;
1717 }
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 ) {
2225 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 ;
2428 if ( typeof supports === 'function' ) {
2529 _supportsPixelated = declarations . some ( function ( d ) {
2630 return supports . apply ( null , d ) ;
2731 } ) ;
2832 } else {
29- var image3 = Drawing . tester . append ( 'image' ) ;
33+ var image3 = Drawing . tester . append ( 'image' )
34+ . attr ( 'style' , constants . STYLE ) ;
35+
3036 var cStyles = window . getComputedStyle ( image3 . node ( ) ) ;
31- image3 . attr ( 'style' , constants . STYLE ) ;
37+ var imageRendering = cStyles . imageRendering ;
38+
3239 _supportsPixelated = declarations . some ( function ( d ) {
3340 var value = d [ 1 ] ;
34- return cStyles . imageRendering === value ||
35- cStyles . imageRendering === value . toLowerCase ( ) ;
41+ return (
42+ imageRendering === value ||
43+ imageRendering === value . toLowerCase ( )
44+ ) ;
3645 } ) ;
46+
3747 image3 . remove ( ) ;
3848 }
3949 }
50+
4051 return _supportsPixelated ;
4152}
4253
0 commit comments