Skip to content
Permalink
Browse files

Made sure that css() in IE handles negative non-px values correctly. F…

…ixes #3331.
  • Loading branch information
jeresig committed Dec 5, 2009
1 parent 6071e93 commit aae0617c834a030902cd8da2714f852d6a1431be
Showing with 6 additions and 3 deletions.
  1. +2 −2 src/css.js
  2. +4 −1 test/unit/css.js
@@ -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,
@@ -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');

0 comments on commit aae0617

Please sign in to comment.
You can’t perform that action at this time.