| 1 | define( [
|
| 2 | "./core",
|
| 3 | "./core/access",
|
| 4 | "./var/isWindow",
|
| 5 | "./css"
|
| 6 | ], function( jQuery, access, isWindow ) {
|
| 7 |
|
| 8 | "use strict";
|
| 9 |
|
| 10 |
|
| 11 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
| 12 | jQuery.each( {
|
| 13 | padding: "inner" + name,
|
| 14 | content: type,
|
| 15 | "": "outer" + name
|
| 16 | }, function( defaultExtra, funcName ) {
|
| 17 |
|
| 18 |
|
| 19 | jQuery.fn[ funcName ] = function( margin, value ) {
|
| 20 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
| 21 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
| 22 |
|
| 23 | return access( this, function( elem, type, value ) {
|
| 24 | var doc;
|
| 25 |
|
| 26 | if ( isWindow( elem ) ) {
|
| 27 |
|
| 28 |
|
| 29 | return funcName.indexOf( "outer" ) === 0 ?
|
| 30 | elem[ "inner" + name ] :
|
| 31 | elem.document.documentElement[ "client" + name ];
|
| 32 | }
|
| 33 |
|
| 34 |
|
| 35 | if ( elem.nodeType === 9 ) {
|
| 36 | doc = elem.documentElement;
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 | return Math.max(
|
| 41 | elem.body[ "scroll" + name ], doc[ "scroll" + name ],
|
| 42 | elem.body[ "offset" + name ], doc[ "offset" + name ],
|
| 43 | doc[ "client" + name ]
|
| 44 | );
|
| 45 | }
|
| 46 |
|
| 47 | return value === undefined ?
|
| 48 |
|
| 49 |
|
| 50 | jQuery.css( elem, type, extra ) :
|
| 51 |
|
| 52 |
|
| 53 | jQuery.style( elem, type, value, extra );
|
| 54 | }, type, chainable ? margin : undefined, chainable );
|
| 55 | };
|
| 56 | } );
|
| 57 | } );
|
| 58 |
|
| 59 | return jQuery;
|
| 60 | } );
|