scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
1 | define( [ |
1 | define([ |
|
2 | "../core", |
2 | "../core", |
|
3 | "./var/rnumnonpx", |
3 | "./var/rnumnonpx", |
|
4 | "./var/rmargin", |
4 | "./var/rmargin", |
|
5 | "./var/getStyles", |
5 | "./var/getStyles", |
|
6 | "./support", |
- | ||
7 | "../selector" // Get jQuery.contains |
6 | "../selector" // contains |
|
8 | ], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { |
7 | ], function( jQuery, rnumnonpx, rmargin, getStyles ) { |
|
9 | |
- | ||
10 | "use strict"; |
- | ||
11 | |
8 | |
|
12 | function curCSS( elem, name, computed ) { |
9 | function curCSS( elem, name, computed ) { |
|
13 | var width, minWidth, maxWidth, ret, |
10 | var width, minWidth, maxWidth, ret, |
|
14 | style = elem.style; |
11 | style = elem.style; |
|
15 | |
12 | |
|
16 | computed = computed || getStyles( elem ); |
13 | computed = computed || getStyles( elem ); |
|
17 | |
14 | |
|
18 | // Support: IE <=9 only |
15 | // Support: IE9 |
|
19 | // getPropertyValue is only needed for .css('filter') (#12537) |
16 | // getPropertyValue is only needed for .css('filter') (#12537) |
|
20 | if ( computed ) { |
17 | if ( computed ) { |
|
21 | ret = computed.getPropertyValue( name ) || computed[ name ]; |
18 | ret = computed.getPropertyValue( name ) || computed[ name ]; |
|
- | 19 | } |
||
- | 20 | |
||
- | 21 | if ( computed ) { |
||
22 | |
22 | |
|
23 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
23 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
|
24 | ret = jQuery.style( elem, name ); |
24 | ret = jQuery.style( elem, name ); |
|
25 | } |
25 | } |
|
- | 26 | |
||
26 | |
27 | // Support: iOS < 6 |
|
27 | // A tribute to the "awesome hack by Dean Edwards" |
28 | // A tribute to the "awesome hack by Dean Edwards" |
|
28 | // Android Browser returns percentage for some values, |
- | ||
29 | // but width seems to be reliably pixels. |
- | ||
30 | // This is against the CSSOM draft spec: |
29 | // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels |
|
31 | // https://drafts.csswg.org/cssom/#resolved-values |
30 | // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values |
|
32 | if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
31 | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
|
33 | |
32 | |
|
34 | // Remember the original values |
33 | // Remember the original values |
|
35 | width = style.width; |
34 | width = style.width; |
|
36 | minWidth = style.minWidth; |
35 | minWidth = style.minWidth; |
|
37 | maxWidth = style.maxWidth; |
36 | maxWidth = style.maxWidth; |
|
38 | |
37 | |
|
39 | // Put in the new values to get a computed value out |
38 | // Put in the new values to get a computed value out |
|
40 | style.minWidth = style.maxWidth = style.width = ret; |
39 | style.minWidth = style.maxWidth = style.width = ret; |
|
41 | ret = computed.width; |
40 | ret = computed.width; |
|
42 | |
41 | |
|
43 | // Revert the changed values |
42 | // Revert the changed values |
|
44 | style.width = width; |
43 | style.width = width; |
|
45 | style.minWidth = minWidth; |
44 | style.minWidth = minWidth; |
|
46 | style.maxWidth = maxWidth; |
45 | style.maxWidth = maxWidth; |
|
47 | } |
46 | } |
|
48 | } |
47 | } |
|
49 | |
48 | |
|
50 | return ret !== undefined ? |
49 | return ret !== undefined ? |
|
51 | |
- | ||
52 | // Support: IE <=9 - 11 only |
50 | // Support: IE |
|
53 | // IE returns zIndex value as an integer. |
51 | // IE returns zIndex value as an integer. |
|
54 | ret + "" : |
52 | ret + "" : |
|
55 | ret; |
53 | ret; |
|
56 | } |
54 | } |
|
57 | |
55 | |
|
58 | return curCSS; |
56 | return curCSS; |
|
59 | } ); |
57 | }); |
|
60 | |
58 | |