From 2c8311c9b5ffb719ce37074027ebcf67dbfee8ad Mon Sep 17 00:00:00 2001 From: Artem Fitiskin Date: Tue, 25 Nov 2014 23:15:54 +0300 Subject: [PATCH] fix bug with defaults method --- jquery.fs.sizer.js | 4 ++-- jquery.fs.sizer.min.js | 4 ++-- src/jquery.fs.sizer.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jquery.fs.sizer.js b/jquery.fs.sizer.js index acfc61c..acb3d6f 100644 --- a/jquery.fs.sizer.js +++ b/jquery.fs.sizer.js @@ -1,5 +1,5 @@ /* - * Sizer v3.0.4 - 2014-05-14 + * Sizer v3.0.4 - 2014-11-25 * A jQuery plugin for matching dimensions. Part of the Formstone Library. * http://formstone.it/sizer/ * @@ -35,7 +35,7 @@ */ defaults: function(opts) { options = $.extend(options, opts || {}); - return $(this); + return (typeof this === 'object') ? $(this) : true; }, /** diff --git a/jquery.fs.sizer.min.js b/jquery.fs.sizer.min.js index dd260b9..dda97b1 100644 --- a/jquery.fs.sizer.min.js +++ b/jquery.fs.sizer.min.js @@ -1,9 +1,9 @@ /* - * Sizer v3.0.4 - 2014-05-14 + * Sizer v3.0.4 - 2014-11-25 * A jQuery plugin for matching dimensions. Part of the Formstone Library. * http://formstone.it/sizer/ * * Copyright 2014 Ben Plum; MIT Licensed */ -!function(a,b){"use strict";function c(b){b=a.extend({},j,b||{});for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return a("#sizer-style").length||a("body").append(''),c}function d(b,c){if(!b.hasClass("sizer")){var d=a.extend({},{$sizer:b,$items:b.find(".sizer-item"),updateParent:b.hasClass("sizer-update")||b.find(".sizer-update").length>0,diabled:!1,resizeTimer:null,oldHeight:""},c,b.data("sizer-options"));d.$items.wrapInner('
'),d.$sizer.addClass("sizer").data("sizer",d),e({data:d}),d.$sizer.find("img").each(function(){var b=a(this);b[0].complete?e({data:d}):b.one("load",function(){e({data:d})})})}}function e(a){var b=a.data;b.resizeTimer=g(b.resizeTimer,5,function(){f(b)})}function f(a){var b=i.width(),c="";if(a.minWidthc&&(c=e)}a.$items.css({height:c}),a.updateParent&&a.$sizer.css({height:c}).find(".sizer-update").css({height:c})}else a.$items.css({height:c}),a.$sizer.css({height:c});a.oldHeight!==c&&(a.oldHeight=c,a.$sizer.trigger("sized.sizer"))}function g(a,b,c){return h(a),setTimeout(c,b)}function h(a){a&&(clearTimeout(a),a=null)}var i=a(b),j={minWidth:0},k={defaults:function(b){return j=a.extend(j,b||{}),a(this)},disable:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&!d.disabled&&(d.disabled=!0,d.$items.css({height:""}),d.updateParent&&d.$sizer.css({height:""}).find(".sizer-update").css({height:""}))})},destroy:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&(d.$sizer.off(".sizer"),d.$items.css({height:""}),d.updateParent&&d.$sizer.css({height:""}).find(".sizer-update").css({height:""}),d.$items.find("sizer-size").unwrap())})},enable:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&d.disabled&&(d.disabled=!1,e({data:d}))})},resize:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&e({data:d})})}};a.fn.sizer=function(a){return k[a]?k[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.sizer=function(a){"defaults"===a&&k.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window); \ No newline at end of file +!function(a,b){"use strict";function c(b){b=a.extend({},j,b||{});for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return a("#sizer-style").length||a("body").append(''),c}function d(b,c){if(!b.hasClass("sizer")){var d=a.extend({},{$sizer:b,$items:b.find(".sizer-item"),updateParent:b.hasClass("sizer-update")||b.find(".sizer-update").length>0,diabled:!1,resizeTimer:null,oldHeight:""},c,b.data("sizer-options"));d.$items.wrapInner('
'),d.$sizer.addClass("sizer").data("sizer",d),e({data:d}),d.$sizer.find("img").each(function(){var b=a(this);b[0].complete?e({data:d}):b.one("load",function(){e({data:d})})})}}function e(a){var b=a.data;b.resizeTimer=g(b.resizeTimer,5,function(){f(b)})}function f(a){var b=i.width(),c="";if(a.minWidthc&&(c=e)}a.$items.css({height:c}),a.updateParent&&a.$sizer.css({height:c}).find(".sizer-update").css({height:c})}else a.$items.css({height:c}),a.$sizer.css({height:c});a.oldHeight!==c&&(a.oldHeight=c,a.$sizer.trigger("sized.sizer"))}function g(a,b,c){return h(a),setTimeout(c,b)}function h(a){a&&(clearTimeout(a),a=null)}var i=a(b),j={minWidth:0},k={defaults:function(b){return j=a.extend(j,b||{}),"object"==typeof this?a(this):!0},disable:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&!d.disabled&&(d.disabled=!0,d.$items.css({height:""}),d.updateParent&&d.$sizer.css({height:""}).find(".sizer-update").css({height:""}))})},destroy:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&(d.$sizer.off(".sizer"),d.$items.css({height:""}),d.updateParent&&d.$sizer.css({height:""}).find(".sizer-update").css({height:""}),d.$items.find("sizer-size").unwrap())})},enable:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&d.disabled&&(d.disabled=!1,e({data:d}))})},resize:function(){return a(this).each(function(b,c){var d=a(c).data("sizer");d&&e({data:d})})}};a.fn.sizer=function(a){return k[a]?k[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.sizer=function(a){"defaults"===a&&k.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window); \ No newline at end of file diff --git a/src/jquery.fs.sizer.js b/src/jquery.fs.sizer.js index 743a1a4..4d53253 100644 --- a/src/jquery.fs.sizer.js +++ b/src/jquery.fs.sizer.js @@ -27,7 +27,7 @@ */ defaults: function(opts) { options = $.extend(options, opts || {}); - return $(this); + return (typeof this === 'object') ? $(this) : true; }, /**