Blame view
app/bower_components/jquery/src/dimensions.js
1.69 KB
|
87c93a029
|
1 |
define( [ |
|
f986e111b
|
2 3 4 5 |
"./core",
"./core/access",
"./css"
], function( jQuery, access ) {
|
|
87c93a029
|
6 |
"use strict"; |
|
f986e111b
|
7 8 |
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
|
87c93a029
|
9 10 11 12 |
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
// Margin is only for outerHeight, outerWidth
|
|
f986e111b
|
13 14 15 16 17 18 19 20 |
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
|
|
87c93a029
|
21 22 23 24 25 |
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) return funcName.indexOf( "outer" ) === 0 ? elem[ "inner" + name ] : elem.document.documentElement[ "client" + name ]; |
|
f986e111b
|
26 27 28 29 30 |
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
|
|
87c93a029
|
31 32 |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], // whichever is greatest |
|
f986e111b
|
33 34 35 36 37 38 39 40 |
return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? |
|
87c93a029
|
41 |
|
|
f986e111b
|
42 43 44 45 46 |
// Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); |
|
87c93a029
|
47 |
}, type, chainable ? margin : undefined, chainable ); |
|
f986e111b
|
48 |
}; |
|
87c93a029
|
49 50 |
} ); } ); |
|
f986e111b
|
51 52 |
return jQuery; |
|
87c93a029
|
53 |
} ); |