git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1ac3713
)
Make sure that non-px values aren't manipulated before input to height/width.
author
John Resig
<jeresig@gmail.com>
Tue, 21 Sep 2010 21:12:42 +0000
(17:12 -0400)
committer
John Resig
<jeresig@gmail.com>
Tue, 21 Sep 2010 21:12:42 +0000
(17:12 -0400)
src/css.js
patch
|
blob
|
history
test/unit/css.js
patch
|
blob
|
history
diff --git
a/src/css.js
b/src/css.js
index
84b6e60
..
69c4452
100644
(file)
--- a/
src/css.js
+++ b/
src/css.js
@@
-155,7
+155,7
@@
jQuery.each(["height", "width"], function( i, name ) {
},
set: function( elem, value ) {
},
set: function( elem, value ) {
- if ( value !== "" ) {
+ if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat(value);
// ignore negative width and height values #1599
value = parseFloat(value);
diff --git
a/test/unit/css.js
b/test/unit/css.js
index
99bab1f
..
0e91ae1
100644
(file)
--- a/
test/unit/css.js
+++ b/
test/unit/css.js
@@
-1,7
+1,7
@@
module("css");
test("css(String|Hash)", function() {
module("css");
test("css(String|Hash)", function() {
- expect(28);
+ expect(29);
equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"');
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." );
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." );
child.attr("class", "em");
equals( parseInt(child.css("fontSize")), 32, "Verify fontSize em set." );