Permalink
Browse files

fixed up the dom-or-load single call

  • Loading branch information...
1 parent 980b16c commit dfbc8f75e8501229b631000e5e52d2855e02106d scottjehl committed Mar 22, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 picturefill.js
View
@@ -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 );

0 comments on commit dfbc8f7

Please sign in to comment.