Skip to content
Browse files

Removed unnecessarry jquerify of image in resize

  • Loading branch information...
1 parent 1b684de commit 812689b7b266a13a742531a3b6da674e8fedb4a3 @JimBobSquarePants committed Jul 27, 2012
Showing with 17 additions and 3 deletions.
  1. +2 −3 img.srcset.polyfill.js
  2. +15 −0 img.srcset.polyfill.min.js
View
5 img.srcset.polyfill.js
@@ -131,9 +131,8 @@
// Run from our cached list.
$.each(imageList, function () {
- var $this = $(this);
-
- setSrc.call($this);
+ // This is jQuerified.
+ setSrc.call(this);
});
View
15 img.srcset.polyfill.min.js
@@ -0,0 +1,15 @@
+/*!
+ * A jQuery based image srcset polyfill that provides fallback behaviour for browsers
+ * that do not support the srcset attribute.
+ *
+ * Copyright 2012 James South
+ *
+ * Twitter: http://twitter.com/james_m_south
+ * Github: https://github.com/JimBobSquarePants/srcset-polyfill
+ *
+ * Supports the current syntax as defined below.
+ *
+ * http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#attr-img-srcset
+ * http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-May/035746.html
+ */
+(function(n){"use strict";var t="srcset";var a=t in document.createElement("img");if(!a){var l=/[^\s]+/,o=/(\d+)h/,e=/(\d+)w/,f=/(\d+)x/,s=window.devicePixelRatio||1,i=n(window),r=[],v=function(n,t,i){function o(){r=null,i||n.apply(u,f)}var f,e,u,r;return function(){var s=i&&!r;return f=arguments,u=this,clearTimeout(r),r=setTimeout(o,t),s&&(e=n.apply(u,f)),e}},c=function(n){for(var a=0,b=0,v=null,u=n.data(t),w=u.length,d=i.width(),k=i.height(),r=0;r<w;r+=1){var y=u[r].match(l)[0],c=o.test(u[r])?parseInt(u[r].match(o)[1],10):1,h=e.test(u[r])?parseInt(u[r].match(e)[1],10):1,p=f.test(u[r])?parseInt(u[r].match(f)[1],10):1;h>a&&d>h&&c>b&&k>c&&p===s&&(a=h,v=y)}return v},u=function(i){var u=function(){var n=this;n.data(t,n.attr(t).split(","));var i=c(n);i&&n.attr("src",i)};if(i){n("img[srcset]").each(function(){var t=n(this);u.call(t),r.push(t)});return}n.each(r,function(){u.call(this)})},h=v(u,100);i.resize(function(){h()}),i.load(function(){u(!0)})}})(jQuery);

0 comments on commit 812689b

Please sign in to comment.
Something went wrong with that request. Please try again.