Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed up the dom-or-load single call

  • Loading branch information...
commit dfbc8f75e8501229b631000e5e52d2855e02106d 1 parent 980b16c
scottjehl authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 picturefill.js
View
12 picturefill.js
@@ -51,12 +51,12 @@
// Run on resize and domready (w.load as a fallback)
if( w.addEventListener ){
w.addEventListener( "resize", w.picturefill, false );
- if( w.document.onDOMContentLoaded ){
- w.document.addEventListener( "DOMContentLoaded", w.picturefill, false );
- }
- else{
- w.addEventListener( "load", w.picturefill, false );
- }
+ w.addEventListener( "DOMContentLoaded", function(){
+ w.picturefill();
+ // Run once only
+ w.removeEventListener( "load", w.picturefill, false );
+ }, false );
+ w.addEventListener( "load", w.picturefill, false );
}
else if( w.attachEvent ){
w.attachEvent( "onload", w.picturefill );
Please sign in to comment.
Something went wrong with that request. Please try again.