@@ -89,7 +89,9 @@ module.exports = {
8989 "test: useStrictCSP" : function ( ) {
9090 ace . config . set ( "useStrictCSP" , undefined ) ;
9191 function getStyleNode ( ) {
92- return document . getElementById ( "test.css" ) ;
92+ return document . adoptedStyleSheets ?
93+ document . adoptedStyleSheets . find ( sheet => sheet . $id === "test.css" ) :
94+ document . getElementById ( "test.css" ) ;
9395 }
9496 assert . ok ( ! getStyleNode ( ) ) ;
9597 dom . importCssString ( "test{}" , "test.css" , false ) ;
@@ -170,6 +172,26 @@ module.exports = {
170172 var editor = ace . edit ( el ) ;
171173 assert . equal ( editor . container , el ) ;
172174 editor . destroy ( ) ;
175+ } ,
176+ "test: use adoptedStyleSheets" : function ( ) {
177+ dom . $resetCssModeForTests ( ) ;
178+ var div = document . createElement ( "div" ) ;
179+ div . adoptedStyleSheets = [ ] ;
180+ div . getRootNode = function ( ) {
181+ return div ;
182+ } ;
183+ if ( ! window . CSSStyleSheet ) {
184+ window . CSSStyleSheet = function ( ) {
185+ this . cssRules = [ ] ;
186+ this . replaceSync = function ( ) { } ;
187+ } ;
188+ }
189+
190+ var editor = ace . edit ( div ) ;
191+ console . log ( div . adoptedStyleSheets ) ;
192+
193+ editor . destroy ( ) ;
194+ dom . $resetCssModeForTests ( ) ;
173195 }
174196} ;
175197
0 commit comments