nl_tokens: TODO this is actually really messed up and overwrites the sheet on elementImpl Tracking in https : // github . com / tmpvar / jsdom / issues / 2124
pl_tokens: function scanForImportRules ( elementImpl , cssRules , baseURL ) { if ( ! cssRules ) { return ; } for ( let i = 0 ; i < cssRules . length ; ++ i ) { if ( cssRules [ i ] . cssRules ) { // @media rule: keep searching inside it. scanForImportRules ( elementImpl , cssRules [ i ] . cssRules , baseURL ) ; } else if ( cssRules [ i ] . href ) { // @import rule: fetch the resource and evaluate it. // See http://dev.w3.org/csswg/cssom/#css-import-rule //     If loading of the style sheet fails its cssRules list is simply //     empty. I.e. an @import rule always has an associated style sheet. const parsed = whatwgURL . parseURL ( cssRules [ i ] . href , { baseURL } ) ; if ( parsed === null ) { const window = elementImpl . _ownerDocument . _defaultView ; if ( window ) { const error = new <mask> ( ` ${ cssRules [ i ] . href } ` + ` ${ whatwgURL . serializeURL ( baseURL ) } ` ) ; error . type = "css @import URL parsing" ; window . _virtualConsole . emit ( "jsdomError" , error ) ; } } else { fetchStylesheetInternal ( elementImpl , whatwgURL . serializeURL ( parsed ) , parsed ) ; } } } }