1 | define([
|
2 | "../core",
|
3 | "./var/rnumnonpx",
|
4 | "./var/rmargin",
|
5 | "./var/getStyles",
|
6 | "../selector"
|
7 | ], function( jQuery, rnumnonpx, rmargin, getStyles ) {
|
8 |
|
9 | function curCSS( elem, name, computed ) {
|
10 | var width, minWidth, maxWidth, ret,
|
11 | style = elem.style;
|
12 |
|
13 | computed = computed || getStyles( elem );
|
14 |
|
15 |
|
16 |
|
17 | if ( computed ) {
|
18 | ret = computed.getPropertyValue( name ) || computed[ name ];
|
19 | }
|
20 |
|
21 | if ( computed ) {
|
22 |
|
23 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
24 | ret = jQuery.style( elem, name );
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
|
32 |
|
33 |
|
34 | width = style.width;
|
35 | minWidth = style.minWidth;
|
36 | maxWidth = style.maxWidth;
|
37 |
|
38 |
|
39 | style.minWidth = style.maxWidth = style.width = ret;
|
40 | ret = computed.width;
|
41 |
|
42 |
|
43 | style.width = width;
|
44 | style.minWidth = minWidth;
|
45 | style.maxWidth = maxWidth;
|
46 | }
|
47 | }
|
48 |
|
49 | return ret !== undefined ?
|
50 |
|
51 |
|
52 | ret + "" :
|
53 | ret;
|
54 | }
|
55 |
|
56 | return curCSS;
|
57 | });
|