2015-08-16 06:59:58 +00:00
|
|
|
define( [
|
2013-08-15 18:15:49 +00:00
|
|
|
"./core",
|
2013-09-09 15:26:21 +00:00
|
|
|
"./core/access",
|
2013-08-15 18:15:49 +00:00
|
|
|
"./css"
|
2013-09-09 15:26:21 +00:00
|
|
|
], function( jQuery, access ) {
|
2013-09-09 16:13:41 +00:00
|
|
|
|
2016-04-25 18:25:08 +00:00
|
|
|
"use strict";
|
|
|
|
|
2012-05-25 01:52:35 +00:00
|
|
|
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
|
2011-12-06 20:25:38 +00:00
|
|
|
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
2014-07-17 17:25:59 +00:00
|
|
|
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
|
|
|
|
function( defaultExtra, funcName ) {
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Margin is only for outerHeight, outerWidth
|
2012-05-25 01:52:35 +00:00
|
|
|
jQuery.fn[ funcName ] = function( margin, value ) {
|
2012-07-10 01:38:11 +00:00
|
|
|
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
2012-05-25 01:52:35 +00:00
|
|
|
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
|
|
|
|
2013-09-09 15:26:21 +00:00
|
|
|
return access( this, function( elem, type, value ) {
|
2012-05-25 01:52:35 +00:00
|
|
|
var doc;
|
|
|
|
|
|
|
|
if ( jQuery.isWindow( elem ) ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2015-11-06 17:24:06 +00:00
|
|
|
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
|
|
|
|
return funcName.indexOf( "outer" ) === 0 ?
|
|
|
|
elem[ "inner" + name ] :
|
|
|
|
elem.document.documentElement[ "client" + name ];
|
2012-02-25 18:13:16 +00:00
|
|
|
}
|
|
|
|
|
2012-05-25 01:52:35 +00:00
|
|
|
// Get document width or height
|
|
|
|
if ( elem.nodeType === 9 ) {
|
|
|
|
doc = elem.documentElement;
|
|
|
|
|
2013-03-13 01:06:25 +00:00
|
|
|
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
|
|
|
|
// whichever is greatest
|
2012-05-25 01:52:35 +00:00
|
|
|
return Math.max(
|
2012-07-10 01:38:11 +00:00
|
|
|
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
|
|
|
|
elem.body[ "offset" + name ], doc[ "offset" + name ],
|
|
|
|
doc[ "client" + name ]
|
2012-05-25 01:52:35 +00:00
|
|
|
);
|
|
|
|
}
|
2010-10-22 06:39:06 +00:00
|
|
|
|
2012-05-25 01:52:35 +00:00
|
|
|
return value === undefined ?
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2012-05-25 01:52:35 +00:00
|
|
|
// Get width or height on the element, requesting but not forcing parseFloat
|
2012-12-10 23:25:23 +00:00
|
|
|
jQuery.css( elem, type, extra ) :
|
2010-11-09 16:09:07 +00:00
|
|
|
|
2012-05-25 01:52:35 +00:00
|
|
|
// Set width or height on the element
|
|
|
|
jQuery.style( elem, type, value, extra );
|
2015-11-09 22:49:01 +00:00
|
|
|
}, type, chainable ? margin : undefined, chainable );
|
2012-05-25 01:52:35 +00:00
|
|
|
};
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
|
|
|
} );
|
2013-09-09 01:25:27 +00:00
|
|
|
|
|
|
|
return jQuery;
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|