File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ jQuery.extend({
167167
168168 // Put in the new values to get a computed value out
169169 elem . runtimeStyle . left = elem . currentStyle . left ;
170- style . left = ret || 0 ;
170+ style . left = camelCase === "fontSize" ? "1em" : ( ret || 0 ) ;
171171 ret = style . pixelLeft + "px" ;
172172
173173 // Revert the changed values
@@ -212,4 +212,4 @@ if ( jQuery.expr && jQuery.expr.filters ) {
212212 jQuery . expr . filters . visible = function ( elem ) {
213213 return ! jQuery . expr . filters . hidden ( elem ) ;
214214 } ;
215- }
215+ }
Original file line number Diff line number Diff line change @@ -103,3 +103,7 @@ div.chain.out { background: green; }
103103div .chain .out div { background : red; display : none; }
104104
105105div # show-tests * { display : none; }
106+
107+ # nothiddendiv { font-size : 16px ; }
108+ # nothiddendivchild .em { font-size : 2em ; }
109+ # nothiddendivchild .prct { font-size : 150% ; }
Original file line number Diff line number Diff line change 11module ( "css" ) ;
22
33test ( "css(String|Hash)" , function ( ) {
4- expect ( 23 ) ;
4+ expect ( 27 ) ;
55
66 equals ( jQuery ( '#main' ) . css ( "display" ) , 'none' , 'Check for css property "display"' ) ;
77
@@ -38,6 +38,17 @@ test("css(String|Hash)", function() {
3838 equals ( jQuery ( '#empty' ) . css ( 'opacity' ) , '0' , "Assert opacity is accessible via filter property set in stylesheet in IE" ) ;
3939 jQuery ( '#empty' ) . css ( { opacity : '1' } ) ;
4040 equals ( jQuery ( '#empty' ) . css ( 'opacity' ) , '1' , "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ) ;
41+
42+ var div = jQuery ( '#nothiddendiv' ) , child = jQuery ( '#nothiddendivchild' ) ;
43+
44+ equals ( parseInt ( div . css ( "fontSize" ) ) , 16 , "Verify fontSize px set." ) ;
45+ equals ( parseInt ( child . css ( "fontSize" ) ) , 16 , "Verify fontSize px set." ) ;
46+
47+ child . attr ( "class" , "em" ) ;
48+ equals ( parseInt ( child . css ( "fontSize" ) ) , 32 , "Verify fontSize em set." ) ;
49+
50+ child . attr ( "class" , "prct" ) ;
51+ equals ( parseInt ( child . css ( "fontSize" ) ) , 24 , "Verify fontSize % set." ) ;
4152} ) ;
4253
4354test ( "css(String, Object)" , function ( ) {
You can’t perform that action at this time.
0 commit comments