fg-loadcss
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -22,9 +22,3 @@ /*! | ||
else { | ||
var refs; | ||
if( doc.querySelectorAll ){ | ||
refs = doc.querySelectorAll( "style,link[rel=stylesheet],script" ); | ||
} | ||
else { | ||
refs = ( doc.body || doc.getElementsByTagName( "head" )[ 0 ] ).childNodes; | ||
} | ||
var refs = ( doc.body || doc.getElementsByTagName( "head" )[ 0 ] ).childNodes; | ||
ref = refs[ refs.length - 1]; | ||
@@ -44,17 +38,13 @@ } | ||
// A method (exposed on return object for external use) that mimics onload by polling until document.styleSheets until it includes the new sheet. | ||
var onloadcssdefined = function ( cb ){ | ||
var defined; | ||
for( var i = 0; i < sheets.length; i++ ){ | ||
var sheet = sheets[i]; | ||
if( sheet.href && sheet.href === ss.href ){ | ||
defined = true; | ||
var onloadcssdefined = function( cb ){ | ||
var resolvedHref = ss.href; | ||
var i = sheets.length; | ||
while( i-- ){ | ||
if( sheets[ i ].href === resolvedHref ){ | ||
return cb(); | ||
} | ||
} | ||
if( defined ){ | ||
cb(); | ||
} else { | ||
setTimeout(function() { | ||
onloadcssdefined( cb ); | ||
}); | ||
} | ||
setTimeout(function() { | ||
onloadcssdefined( cb ); | ||
}); | ||
}; | ||
@@ -69,2 +59,7 @@ | ||
}; | ||
// commonjs | ||
if( module ){ | ||
module.exports = w.loadCSS; | ||
} | ||
}(this)); | ||
{ | ||
"name": "fg-loadcss", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A function for loading CSS asynchronously", | ||
@@ -5,0 +5,0 @@ "main": "loadCSS.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23
0
86838
2249