X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=92945a4ca5d8cf76ac3d7a08c01891e7447d8e06;hb=b45325765327d257f00b55cd5383287c1bd94875;hp=1236f1c65771141a53baeb86acf75e016f796472;hpb=e0c6e4ef98302345cc17131675e2c1f9f17b62f1;p=jquery.git diff --git a/src/core.js b/src/core.js index 1236f1c..92945a4 100644 --- a/src/core.js +++ b/src/core.js @@ -1038,7 +1038,8 @@ jQuery.extend({ checked: "checked", readonly: "readOnly", selected: "selected", - maxlength: "maxLength" + maxlength: "maxLength", + selectedIndex: "selectedIndex" } }); @@ -1114,16 +1115,27 @@ jQuery.each( [ "Height", "Width" ], function(i,name){ var n = name.toLowerCase(); jQuery.fn[ n ] = function(h) { + // Get window width or height return this[0] == window ? + // Opera reports document.body.client[Width/Height] properly in both quirks and standards + jQuery.browser.opera && document.body["client" + name] || + + // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths) jQuery.browser.safari && self["inner" + name] || - jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) || - document.body["client" + name] : + + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode + document.compatMode == "CSS1Compat" && document.documentElement["client" + name] || document.body["client" + name] : + // Get document width or height this[0] == document ? + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater (Mozilla reports scrollWidth the same as offsetWidth) Math.max( document.body["scroll" + name], document.body["offset" + name] ) : + // Get or set width or height on the element h == undefined ? + // Get width or height on the element ( this.length ? jQuery.css( this[0], n ) : null ) : + // Set the width or height on the element (default to pixels if value is unitless) this.css( n, h.constructor == String ? h : h + "px" ); }; });