CSS: Return values should be numbers

Fixes #14792
This commit is contained in:
Dave Methvin 2014-03-03 20:55:30 -05:00
parent 06adf7c95d
commit f4b37d8982
2 changed files with 4 additions and 3 deletions

View File

@ -29,8 +29,8 @@ var
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = { cssNormalTransform = {
letterSpacing: 0, letterSpacing: "0",
fontWeight: 400 fontWeight: "400"
}, },
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];

View File

@ -813,12 +813,13 @@ testIframeWithCallback( "css('width') should work correctly before document read
); );
test("certain css values of 'normal' should be convertable to a number, see #8627", function() { test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
expect ( 2 ); expect ( 3 );
var el = jQuery("<div style='letter-spacing:normal;font-weight:normal;'>test</div>").appendTo("#qunit-fixture"); var el = jQuery("<div style='letter-spacing:normal;font-weight:normal;'>test</div>").appendTo("#qunit-fixture");
ok( jQuery.isNumeric( parseFloat( el.css("letterSpacing") ) ), "css('letterSpacing') not convertable to number, see #8627" ); ok( jQuery.isNumeric( parseFloat( el.css("letterSpacing") ) ), "css('letterSpacing') not convertable to number, see #8627" );
ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" ); ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
equal( typeof el.css( "fontWeight" ), "string", ".css() returns a string" );
}); });
// only run this test in IE9 // only run this test in IE9