scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
1 | define( [ |
1 | define([ |
|
2 | "./core", |
2 | "./core", |
|
3 | "./core/access", |
3 | "./core/access", |
|
4 | "./css" |
4 | "./css" |
|
5 | ], function( jQuery, access ) { |
5 | ], function( jQuery, access ) { |
|
6 | |
- | ||
7 | "use strict"; |
- | ||
8 | |
6 | |
|
9 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
7 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
10 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
8 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
11 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
- | ||
12 | function( defaultExtra, funcName ) { |
- | ||
13 | |
9 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { |
|
14 | // Margin is only for outerHeight, outerWidth |
10 | // Margin is only for outerHeight, outerWidth |
|
15 | jQuery.fn[ funcName ] = function( margin, value ) { |
11 | jQuery.fn[ funcName ] = function( margin, value ) { |
|
16 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
12 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
17 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
13 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
18 | |
14 | |
|
19 | return access( this, function( elem, type, value ) { |
15 | return access( this, function( elem, type, value ) { |
|
20 | var doc; |
16 | var doc; |
|
21 | |
17 | |
|
22 | if ( jQuery.isWindow( elem ) ) { |
18 | if ( jQuery.isWindow( elem ) ) { |
|
23 | |
- | ||
24 | // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
19 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
|
25 | return funcName.indexOf( "outer" ) === 0 ? |
20 | // isn't a whole lot we can do. See pull request at this URL for discussion: |
|
26 | elem[ "inner" + name ] : |
21 | // https://github.com/jquery/jquery/pull/764 |
|
27 | elem.document.documentElement[ "client" + name ]; |
22 | return elem.document.documentElement[ "client" + name ]; |
|
28 | } |
23 | } |
|
29 | |
24 | |
|
30 | // Get document width or height |
25 | // Get document width or height |
|
31 | if ( elem.nodeType === 9 ) { |
26 | if ( elem.nodeType === 9 ) { |
|
32 | doc = elem.documentElement; |
27 | doc = elem.documentElement; |
|
33 | |
28 | |
|
34 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
29 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
35 | // whichever is greatest |
30 | // whichever is greatest |
|
36 | return Math.max( |
31 | return Math.max( |
|
37 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
32 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
38 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
33 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
39 | doc[ "client" + name ] |
34 | doc[ "client" + name ] |
|
40 | ); |
35 | ); |
|
41 | } |
36 | } |
|
42 | |
37 | |
|
43 | return value === undefined ? |
38 | return value === undefined ? |
|
44 | |
- | ||
45 | // Get width or height on the element, requesting but not forcing parseFloat |
39 | // Get width or height on the element, requesting but not forcing parseFloat |
|
46 | jQuery.css( elem, type, extra ) : |
40 | jQuery.css( elem, type, extra ) : |
|
47 | |
41 | |
|
48 | // Set width or height on the element |
42 | // Set width or height on the element |
|
49 | jQuery.style( elem, type, value, extra ); |
43 | jQuery.style( elem, type, value, extra ); |
|
50 | }, type, chainable ? margin : undefined, chainable ); |
44 | }, type, chainable ? margin : undefined, chainable, null ); |
|
51 | }; |
45 | }; |
|
52 | } ); |
46 | }); |
|
53 | } ); |
47 | }); |
|
54 | |
48 | |
|
55 | return jQuery; |
49 | return jQuery; |
|
56 | } ); |
50 | }); |
|
57 | |
51 | |