4 ], function( jQuery ) {
5 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
6 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
7 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
8 // margin is only for outerHeight, outerWidth
9 jQuery.fn[ funcName ] = function( margin, value ) {
10 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
11 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
13 return jQuery.access( this, function( elem, type, value ) {
16 if ( jQuery.isWindow( elem ) ) {
17 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
18 // isn't a whole lot we can do. See pull request at this URL for discussion:
19 // https://github.com/jquery/jquery/pull/764
20 return elem.document.documentElement[ "client" + name ];
23 // Get document width or height
24 if ( elem.nodeType === 9 ) {
25 doc = elem.documentElement;
27 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
28 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
30 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
31 elem.body[ "offset" + name ], doc[ "offset" + name ],
32 doc[ "client" + name ]
36 return value === undefined ?
37 // Get width or height on the element, requesting but not forcing parseFloat
38 jQuery.css( elem, type, extra ) :
40 // Set width or height on the element
41 jQuery.style( elem, type, value, extra );
42 }, type, chainable ? margin : undefined, chainable, null );