Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support setting camelCased css property with number values

  • Loading branch information...
commit 1a4cced2c9a9228c95840a9ac3c8649c1d24e25c 1 parent 27b45c0
Ed Tsech edtsech authored
Showing with 3 additions and 2 deletions.
  1. +1 −1  src/zepto.js
  2. +2 −1  test/zepto.html
2  src/zepto.js
View
@@ -32,7 +32,7 @@ var Zepto = (function() {
classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)'));
}
- function maybeAddPx(name, value) { return (typeof value == "number" && !cssNumber[name]) ? value + "px" : value; }
+ function maybeAddPx(name, value) { return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value; }
function defaultDisplay(nodeName) {
var element, display;
3  test/zepto.html
View
@@ -672,6 +672,7 @@
$('#some_element').css('marginBottom', '5px');
$('#some_element').css('left', 42);
$('#some_element').css('z-index', 10);
+ $('#some_element').css('fontWeight', 300);
$('#some_element').css('border', '1px solid rgba(255,0,0,1)');
t.assertEqual('rgb(255, 0, 0)', el.style.color);
t.assertEqual('rgb(255, 0, 0)', el.style.borderLeftColor);
@@ -679,7 +680,7 @@
t.assertEqual('10px', el.style.marginTop);
t.assertEqual('5px', el.style.marginBottom);
t.assertEqual('42px', el.style.left);
-
+ t.assertEqual(300, el.style.fontWeight);
t.assertEqual(10, el.style.zIndex);
var style1 = $('#some_element').css('color');
Please sign in to comment.
Something went wrong with that request. Please try again.