1 /*! CSS rel=preload polyfill. Depends on loadCSS function. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */
3 // rel=preload support test
7 var rp = loadCSS.relpreload = {};
8 rp.support = function(){
10 return w.document.createElement( "link" ).relList.supports( "preload" );
16 // loop preload links and fetch using loadCSS
18 var links = w.document.getElementsByTagName( "link" );
19 for( var i = 0; i < links.length; i++ ){
20 var link = links[ i ];
21 if( link.rel === "preload" && link.getAttribute( "as" ) === "style" ){
22 w.loadCSS( link.href, link );
28 // if link[rel=preload] is not supported, we must fetch the CSS manually using loadCSS
31 var run = w.setInterval( rp.poly, 300 );
32 if( w.addEventListener ){
33 w.addEventListener( "load", function(){
34 w.clearInterval( run );
38 w.attachEvent( "onload", function(){
39 w.clearInterval( run );