Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request scottjehl#158 from bryanburgers/alt-bug
Browse files Browse the repository at this point in the history
Only add img[alt] when [data-alt] exists
  • Loading branch information
scottjehl committed Apr 10, 2014
2 parents ece2260 + e8d7f32 commit bc7b125
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion picturefill.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
var matchedEl = matches.pop();
if( !picImg || picImg.parentNode.nodeName === "NOSCRIPT" ){
picImg = w.document.createElement( "img" );
picImg.alt = ps[ i ].getAttribute( "data-alt" );
var alt = ps[ i ].getAttribute( "data-alt" );
if (alt !== null) {
picImg.alt = alt;
}
}
else if( matchedEl === picImg.parentNode ){
// Skip further actions if the correct image is already in place
Expand Down

0 comments on commit bc7b125

Please sign in to comment.