aboutsummaryrefslogtreecommitdiffstats
path: root/src/number.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/number.js')
-rw-r--r--src/number.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/number.js b/src/number.js
index e45a8c6..ae3c120 100644
--- a/src/number.js
+++ b/src/number.js
@@ -8,7 +8,8 @@ SVG.Number = function(value) {
/* parse value */
switch(typeof value) {
case 'number':
- this.value = value
+ /* ensure a valid numeric value */
+ this.value = isNaN(value) ? 0 : !isFinite(value) ? (value < 0 ? Number.MIN_VALUE : Number.MAX_VALUE) : value
break
case 'string':
var match = value.match(SVG.regex.unit)