Permalink
Browse files

Make sure that non-px values aren't manipulated before input to heigh…

…t/width.
  • Loading branch information...
jeresig committed Sep 21, 2010
1 parent 1ac3713 commit e3463946e19f2eb53d909fc2b59cc1c8636d21bd
Showing with 5 additions and 2 deletions.
  1. +1 −1 src/css.js
  2. +4 −1 test/unit/css.js
@@ -155,7 +155,7 @@ jQuery.each(["height", "width"], function( i, name ) {
},

set: function( elem, value ) {
if ( value !== "" ) {
if ( rnumpx.test( value ) ) {

This comment has been minimized.

@jeresig

jeresig Sep 23, 2010

Author Member

Yeah, this was an issue with the test suite in this case - the change actually made it do the right thing. I adjusted the test in 6a1d4f1 to just set "" instead of auto - giving a similar effect across all the tests. Thanks!

// ignore negative width and height values #1599
value = parseFloat(value);

@@ -1,7 +1,7 @@
module("css");

test("css(String|Hash)", function() {
expect(28);
expect(29);

equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"');

@@ -44,6 +44,9 @@ test("css(String|Hash)", function() {
equals( parseInt(child.css("fontSize")), 16, "Verify fontSize px set." );
equals( parseInt(child.css("font-size")), 16, "Verify fontSize px set." );

child.css("height", "100%");
equals( child[0].style.height, "100%", "Make sure the height is being set correctly." );

child.attr("class", "em");
equals( parseInt(child.css("fontSize")), 32, "Verify fontSize em set." );

0 comments on commit e346394

Please sign in to comment.