summaryrefslogtreecommitdiffstats
path: root/src/regex.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-03-24 19:19:06 +0100
committerwout <wout@impinc.co.uk>2013-03-24 19:19:06 +0100
commit67d367e0d74b3287956130da0077e42c6483dd2f (patch)
treebb2d23315e39c89b79cb8c52e7a5db54636e08ad /src/regex.js
parentff09596144c3fd6770d1dc64178a10c2432396ca (diff)
downloadsvg.js-67d367e0d74b3287956130da0077e42c6483dd2f.tar.gz
svg.js-67d367e0d74b3287956130da0077e42c6483dd2f.zip
Bumped to v0.11
- removed SVG.Wrap on SVG.Polyline, SVG.Polygon and SVG.Path - added delay on SVG.FX module - made x(), y(), cx() and cy() as getters - added SGB.get() method, to get elements by a DOM id - fixed bug in remove() method on container elements - added jasmine test suite to repo
Diffstat (limited to 'src/regex.js')
-rw-r--r--src/regex.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/regex.js b/src/regex.js
index 3639358..7b268f6 100644
--- a/src/regex.js
+++ b/src/regex.js
@@ -1,7 +1,12 @@
// Storage for regular expressions
SVG.regex = {
+ /* test a given value */
+ test: function(value, test) {
+ return this[test].test(value)
+ }
+
/* 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
@@ -30,4 +35,7 @@ SVG.regex = {
/* test for blank string */
, isBlank: /^(\s+)?$/
+ /* test for numeric string */
+, isNumber: /^-?[\d\.]+$/
+
} \ No newline at end of file