diff --git a/bonzo.js b/bonzo.js index 7c5b37a..b6f3740 100644 --- a/bonzo.js +++ b/bonzo.js @@ -13,7 +13,7 @@ , html = doc.documentElement , parentNode = 'parentNode' , query = null // used for setting a selector engine host - , specialAttributes = /^(checked|value|selected)$/i + , specialAttributes = /^(checked|value|selected|disabled)$/i , specialTags = /^(select|fieldset|table|tbody|tfoot|td|tr|colgroup)$/i // tags that we have trouble inserting *into* , table = ['', '
', 1] , td = ['', '
', 3] @@ -29,7 +29,7 @@ , option: option, optgroup: option , script: noscope, style: noscope, link: noscope, param: noscope, base: noscope } - , stateAttributes = /^(checked|selected)$/ + , stateAttributes = /^(checked|selected|disabled)$/ , ie = /msie/i.test(navigator.userAgent) , hasClass, addClass, removeClass , uidMap = {} @@ -618,7 +618,7 @@ * @return {Bonzo} */ , show: function (opt_type) { - opt_type = typeof opt_type == 'string' ? opt_type : '' + opt_type = typeof opt_type == 'string' ? opt_type : '' return this.each(function (el) { el.style.display = opt_type }) @@ -642,9 +642,10 @@ */ , toggle: function (opt_callback, opt_type) { opt_type = typeof opt_type == 'string' ? opt_type : ''; + typeof opt_callback != 'function' && (opt_callback = null) return this.each(function (el) { el.style.display = (el.offsetWidth || el.offsetHeight) ? 'none' : opt_type; - typeof opt_callback == 'function' && opt_callback.call(el) + opt_callback && opt_callback.call(el) }) } diff --git a/bonzo.min.js b/bonzo.min.js index ee6a2b5..1037e55 100644 --- a/bonzo.min.js +++ b/bonzo.min.js @@ -3,4 +3,4 @@ * https://github.com/ded/bonzo * License MIT */ -(function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=t():typeof n["define"]=="function"&&n.define.amd?define(e,t):n[e]=t()})("bonzo",function(){function M(e){return new RegExp("(^|\\s+)"+e+"(\\s+|$)")}function _(e,t,n,r){var i,s=0,o=e.length;for(;s0?J(o,r):r)},null,r)},this,r),o.length=s,_(u,function(e){o[--s]=e},null,!r),o}function W(e,t,n){var r=Y(e),i=r.css("position"),s=r.offset(),o="relative",u=i==o,a=[parseInt(r.css("left"),10),parseInt(r.css("top"),10)];i=="static"&&(r.css("position",o),i=o),isNaN(a[0])&&(a[0]=u?0:e.offsetLeft),isNaN(a[1])&&(a[1]=u?0:e.offsetTop),t!=null&&(e.style.left=t-s.left+a[0]+E),n!=null&&(e.style.top=n-s.top+a[1]+E)}function X(e,t){return typeof t=="function"?t(e):t}function V(e){this.length=0;if(e){e=typeof e!="string"&&!e.nodeType&&typeof e.length!="undefined"?e:[e],this.length=e.length;for(var t=0;t","",1],a=["","
",3],f=["",1],l=["_","",0,1],c={thead:u,tbody:u,tfoot:u,colgroup:u,caption:u,tr:["","
",2],th:a,td:a,col:["","
",2],fieldset:["
","
",1],legend:["
","
",2],option:f,optgroup:f,script:l,style:l,link:l,param:l,base:l},h=/^(checked|selected)$/,p=/msie/i.test(navigator.userAgent),d,v,m,g={},y=0,b=/^-?[\d\.]+$/,w=/^data-(.+)$/,E="px",S="setAttribute",x="getAttribute",T="getElementsByTagName",N=function(){var e=t.createElement("p");return e.innerHTML='x
',{hrefExtended:e[T]("a")[0][x]("href")!="#x",autoTbody:e[T]("tbody").length!==0,computedStyle:t.defaultView&&t.defaultView.getComputedStyle,cssFloat:e[T]("table")[0].style.styleFloat?"styleFloat":"cssFloat",transform:function(){var t=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],n;for(n=0;n]+)/.exec(e),i=t.createElement("div"),s=[],o=n?c[n[1].toLowerCase()]:null,u=o?o[2]+1:1,a=o&&o[3],f=r,l=N.autoTbody&&o&&o[0]==""&&!/0?J(o,r):r)},null,r)},this,r),o.length=s,_(u,function(e){o[--s]=e},null,!r),o}function W(e,t,n){var r=Y(e),i=r.css("position"),s=r.offset(),o="relative",u=i==o,a=[parseInt(r.css("left"),10),parseInt(r.css("top"),10)];i=="static"&&(r.css("position",o),i=o),isNaN(a[0])&&(a[0]=u?0:e.offsetLeft),isNaN(a[1])&&(a[1]=u?0:e.offsetTop),t!=null&&(e.style.left=t-s.left+a[0]+E),n!=null&&(e.style.top=n-s.top+a[1]+E)}function X(e,t){return typeof t=="function"?t(e):t}function V(e){this.length=0;if(e){e=typeof e!="string"&&!e.nodeType&&typeof e.length!="undefined"?e:[e],this.length=e.length;for(var t=0;t","
",1],a=["","
",3],f=["",1],l=["_","",0,1],c={thead:u,tbody:u,tfoot:u,colgroup:u,caption:u,tr:["","
",2],th:a,td:a,col:["","
",2],fieldset:["
","
",1],legend:["
","
",2],option:f,optgroup:f,script:l,style:l,link:l,param:l,base:l},h=/^(checked|selected|disabled)$/,p=/msie/i.test(navigator.userAgent),d,v,m,g={},y=0,b=/^-?[\d\.]+$/,w=/^data-(.+)$/,E="px",S="setAttribute",x="getAttribute",T="getElementsByTagName",N=function(){var e=t.createElement("p");return e.innerHTML='x
',{hrefExtended:e[T]("a")[0][x]("href")!="#x",autoTbody:e[T]("tbody").length!==0,computedStyle:t.defaultView&&t.defaultView.getComputedStyle,cssFloat:e[T]("table")[0].style.styleFloat?"styleFloat":"cssFloat",transform:function(){var t=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],n;for(n=0;n]+)/.exec(e),i=t.createElement("div"),s=[],o=n?c[n[1].toLowerCase()]:null,u=o?o[2]+1:1,a=o&&o[3],f=r,l=N.autoTbody&&o&&o[0]==""&&!/ (http://dustindiaz.com)" , "contributors": [