diff options
author | wout <wout@impinc.co.uk> | 2013-06-30 11:16:59 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-30 11:16:59 +0100 |
commit | 578c2bd6dffed8a636e64dbfbfedd3eb53539665 (patch) | |
tree | 93f656fb9087233bd189c93b53696cd3548242fa /src | |
parent | e4fb8522a2c57069b2523f16de92d5eb7e6dd85e (diff) | |
download | svg.js-578c2bd6dffed8a636e64dbfbfedd3eb53539665.tar.gz svg.js-578c2bd6dffed8a636e64dbfbfedd3eb53539665.zip |
Fix in unit parser with negative values.
Diffstat (limited to 'src')
-rw-r--r-- | src/number.js | 2 | ||||
-rw-r--r-- | src/regex.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/number.js b/src/number.js index 28e260e..8cbf93a 100644 --- a/src/number.js +++ b/src/number.js @@ -13,7 +13,7 @@ SVG.Number = function(value) { case 'string': var match = value.match(SVG.regex.unit) - /* make valu numeric */ + /* make value numeric */ this.value = parseFloat(match[1]) /* normalize percent value */ diff --git a/src/regex.js b/src/regex.js index 4286d8a..602d2c7 100644 --- a/src/regex.js +++ b/src/regex.js @@ -6,7 +6,7 @@ SVG.regex = { } /* parse unit value */ -, unit: /^([\d\.]+)([a-z%]{0,2})$/ +, unit: /^(-?[\d\.]+)([a-z%]{0,2})$/ /* parse hex value */ , hex: /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i |