scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
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 ) { |
|
Line 6... | Line -... | |||
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" ), |
|
Line 17... | Line 13... | |||
17 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
13 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
18 | |
14 | |
|
Line 19... | Line 15... | |||
19 | return access( this, function( elem, type, value ) { |
15 | return access( this, function( elem, type, value ) { |
|
20 | var doc; |
- | ||
21 | |
16 | var doc; |
|
22 | if ( jQuery.isWindow( elem ) ) { |
17 | |
|
23 | |
18 | if ( jQuery.isWindow( elem ) ) { |
|
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: |
|
Line 26... | Line 21... | |||
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 | } |
|
Line 39... | Line 34... | |||
39 | doc[ "client" + name ] |
34 | doc[ "client" + name ] |
|
40 | ); |
35 | ); |
|
41 | } |
36 | } |
|
Line 42... | Line 37... | |||
42 | |
37 | |
|
43 | return value === undefined ? |
- | ||
44 | |
38 | return value === undefined ? |
|
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 |
|
Line 46... | Line 40... | |||
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 | }; |
|
Line 52... | Line 46... | |||
52 | } ); |
46 | }); |
|
53 | } ); |
47 | }); |