nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jquery / src / dimensions.js
1 define( [
2         "./core",
3         "./core/access",
4         "./css"
5 ], function( jQuery, access ) {
6
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 ) {
11
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" );
16
17                         return access( this, function( elem, type, value ) {
18                                 var doc;
19
20                                 if ( jQuery.isWindow( elem ) ) {
21
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 ];
26                                 }
27
28                                 // Get document width or height
29                                 if ( elem.nodeType === 9 ) {
30                                         doc = elem.documentElement;
31
32                                         // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
33                                         // whichever is greatest
34                                         return Math.max(
35                                                 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
36                                                 elem.body[ "offset" + name ], doc[ "offset" + name ],
37                                                 doc[ "client" + name ]
38                                         );
39                                 }
40
41                                 return value === undefined ?
42
43                                         // Get width or height on the element, requesting but not forcing parseFloat
44                                         jQuery.css( elem, type, extra ) :
45
46                                         // Set width or height on the element
47                                         jQuery.style( elem, type, value, extra );
48                         }, type, chainable ? margin : undefined, chainable, null );
49                 };
50         } );
51 } );
52
53 return jQuery;
54 } );