From 784be1e7cee7989a427d0b64538ee77a469f5a59 Mon Sep 17 00:00:00 2001 From: Stephen Rushing Date: Fri, 21 Jun 2013 11:19:26 -0400 Subject: [PATCH 1/2] Added jQuery plugin and $.support.boxSizing property. The jQuery plugin applies the boxsizing.htc behavior asynchronyously as to not delay the rest of the page. If the browser already support boxSizing, the plugin does nothing. Usage would be something like: $(document).ready(function(){ $.fn.boxSizing.defaults.htcPath = '/js/boxsizing.htc'; $('*').boxSizing(); }); --- jquery.boxSizing.js | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 jquery.boxSizing.js diff --git a/jquery.boxSizing.js b/jquery.boxSizing.js new file mode 100644 index 0000000..c3d127a --- /dev/null +++ b/jquery.boxSizing.js @@ -0,0 +1,46 @@ +(function($, undefined){ + + $.support.boxSizing = ('boxSizing' in document.createElement('div').style) && (document.documentMode === undefined || document.documentMode > 7); + + $.fn.boxSizing = function(options){ + + var I = this, + o = $.extend({}, arguments.callee.defaults, options); + + if($.support.boxSizing) return; //If box-sizing is supported, don't do anything. + + //Use a queue to add behaviors separately, so they don't hold up the rest of the page. + var q = [], + clearQueue = function(){ + for(var i=0; i Date: Fri, 21 Jun 2013 15:24:48 -0400 Subject: [PATCH 2/2] Removed window resize binding Binding to window resize doesn't accomplish anything here. --- jquery.boxSizing.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jquery.boxSizing.js b/jquery.boxSizing.js index c3d127a..7e209bc 100644 --- a/jquery.boxSizing.js +++ b/jquery.boxSizing.js @@ -35,7 +35,6 @@ }; size(); - $(window).resize(size); };