Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Safari 4.0 compatibility fix #56

Closed
wants to merge 1 commit into from

2 participants

Simon Wade Scott Jehl
Simon Wade

Safari 4.0 returns the <img> inside the <noscript> tag, which
results in a new <img> not being appended to the <div>. This fix
ensures that these images are ignored.

Simon Wade aexmachina Safari 4.0 compatibility fix
Safari 4.0 returns the <img> inside the <noscript> tag, which 
prevents the new <img> being appended to the <div>. This fix
ensures that these images are ignored.
169ac4f
Scott Jehl
Owner

I'd like to merge this fix but it looks like it'll need to be fixed up a bit to merge cleanly. I'll make the change now and give you credit in the commit msg.
Also, any reason this can't be just `picImg.parentNode.nodeName === 'NOSCRIPT'?

Scott Jehl scottjehl closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2013
  1. Simon Wade

    Safari 4.0 compatibility fix

    aexmachina authored
    Safari 4.0 returns the <img> inside the <noscript> tag, which 
    prevents the new <img> being appended to the <div>. This fix
    ensures that these images are ignored.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 picturefill.js
4 picturefill.js
View
@@ -28,7 +28,7 @@
var picImg = ps[ i ].getElementsByTagName( "img" )[ 0 ];
if( matches.length ){
- if( !picImg ){
+ if( !picImg || picImg.parentNode.tagName.toUpperCase() == 'NOSCRIPT' ){
picImg = w.document.createElement( "img" );
picImg.alt = ps[ i ].getAttribute( "data-alt" );
ps[ i ].appendChild( picImg );
@@ -57,4 +57,4 @@
w.attachEvent( "onload", w.picturefill );
}
-}( this ));
+}( this ));
Something went wrong with that request. Please try again.