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 },
10 function( defaultExtra, funcName ) {
12 // Margin is only for outerHeight, outerWidth
13 jQuery.fn[ funcName ] = function( margin, value ) {
14 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
15 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
17 return access( this, function( elem, type, value ) {
20 if ( jQuery.isWindow( elem ) ) {
22 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
23 // isn't a whole lot we can do. See pull request at this URL for discussion:
24 // https://github.com/jquery/jquery/pull/764
25 return elem.document.documentElement[ "client" + name ];
28 // Get document width or height
29 if ( elem.nodeType === 9 ) {
30 doc = elem.documentElement;
32 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
33 // whichever is greatest
35 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
36 elem.body[ "offset" + name ], doc[ "offset" + name ],
37 doc[ "client" + name ]
41 return value === undefined ?
43 // Get width or height on the element, requesting but not forcing parseFloat
44 jQuery.css( elem, type, extra ) :
46 // Set width or height on the element
47 jQuery.style( elem, type, value, extra );
48 }, type, chainable ? margin : undefined, chainable, null );