Made sure that css() in IE handles negative non-px values correctly. Fixes #3331.

This commit is contained in:
jeresig 2009-12-05 15:12:02 -05:00
parent 6071e939c7
commit aae0617c83
2 changed files with 6 additions and 3 deletions

View File

@ -5,8 +5,8 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
rfloat = /float/i,
rdashAlpha = /-([a-z])/ig,
rupper = /([A-Z])/g,
rnumpx = /^\d+(?:px)?$/i,
rnum = /^\d/,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
// cache check for defaultView.getComputedStyle
getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,

View File

@ -59,13 +59,16 @@ test("css(String|Hash)", function() {
});
test("css(String, Object)", function() {
expect(20);
expect(21);
ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible');
jQuery('#nothiddendiv').css("display", 'none');
ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden');
jQuery('#nothiddendiv').css("display", 'block');
ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible');
jQuery("#nothiddendiv").css("top", "-1em");
ok( jQuery("#nothiddendiv").css("top"), -16, "Check negative number in EMs." );
jQuery('#floatTest').css('styleFloat', 'left');
equals( jQuery('#floatTest').css('styleFloat'), 'left', 'Modified CSS float using "styleFloat": Assert float is left');
jQuery('#floatTest').css('cssFloat', 'right');