| 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( { padding: "inner" + name, content: type, "": "outer" + name },
|
| 13 | function( defaultExtra, funcName ) {
|
| 14 |
|
| 15 |
|
| 16 | jQuery.fn[ funcName ] = function( margin, value ) {
|
| 17 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
| 18 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
| 19 |
|
| 20 | return access( this, function( elem, type, value ) {
|
| 21 | var doc;
|
| 22 |
|
| 23 | if ( isWindow( elem ) ) {
|
| 24 |
|
| 25 |
|
| 26 | return funcName.indexOf( "outer" ) === 0 ?
|
| 27 | elem[ "inner" + name ] :
|
| 28 | elem.document.documentElement[ "client" + name ];
|
| 29 | }
|
| 30 |
|
| 31 |
|
| 32 | if ( elem.nodeType === 9 ) {
|
| 33 | doc = elem.documentElement;
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 | return Math.max(
|
| 38 | elem.body[ "scroll" + name ], doc[ "scroll" + name ],
|
| 39 | elem.body[ "offset" + name ], doc[ "offset" + name ],
|
| 40 | doc[ "client" + name ]
|
| 41 | );
|
| 42 | }
|
| 43 |
|
| 44 | return value === undefined ?
|
| 45 |
|
| 46 |
|
| 47 | jQuery.css( elem, type, extra ) :
|
| 48 |
|
| 49 |
|
| 50 | jQuery.style( elem, type, value, extra );
|
| 51 | }, type, chainable ? margin : undefined, chainable );
|
| 52 | };
|
| 53 | } );
|
| 54 | } );
|
| 55 |
|
| 56 | return jQuery;
|
| 57 | } );
|