Skip to content

Commit

Permalink
Avoid creating two img elements
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Aug 12, 2014
1 parent 0512173 commit d541aa9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/picturefill.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
pf.ns = "picturefill";

// srcset support test
pf.srcsetSupported = "srcset" in doc.createElement( "img" );
pf.sizesSupported = "sizes" in doc.createElement( "img" );
(function() {
var img = doc.createElement( "img" );
pf.srcsetSupported = "srcset" in img;
pf.sizesSupported = "sizes" in img;
})();

// just a string trim workaround
pf.trim = function( str ) {
Expand Down

0 comments on commit d541aa9

Please sign in to comment.