5 ], function( jQuery, access ) {
7 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
8 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
10 // margin is only for outerHeight, outerWidth
11 jQuery.fn[ funcName ] = function( margin, value ) {
12 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
13 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
15 return access( this, function( elem, type, value ) {
18 if ( jQuery.isWindow( elem ) ) {
19 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
20 // isn't a whole lot we can do. See pull request at this URL for discussion:
21 // https://github.com/jquery/jquery/pull/764
22 return elem.document.documentElement[ "client" + name ];
25 // Get document width or height
26 if ( elem.nodeType === 9 ) {
27 doc = elem.documentElement;
29 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
30 // whichever is greatest
32 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
33 elem.body[ "offset" + name ], doc[ "offset" + name ],
34 doc[ "client" + name ]
38 return value === undefined ?
39 // Get width or height on the element, requesting but not forcing parseFloat
40 jQuery.css( elem, type, extra ) :
42 // Set width or height on the element
43 jQuery.style( elem, type, value, extra );
44 }, type, chainable ? margin : undefined, chainable, null );