aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-25 15:20:44 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-25 15:20:44 +1000
commitb8427b841323fe2c8dc14584b0b10c30159d2023 (patch)
treed20167149a5b5ef294e70e618584f8ca38c8decd /src
parente058f51bf16cd908a266391f7d657f35e501bb17 (diff)
downloadsvg.js-b8427b841323fe2c8dc14584b0b10c30159d2023.tar.gz
svg.js-b8427b841323fe2c8dc14584b0b10c30159d2023.zip
sort out unused regex, add parser and regex tests, fix textable tests
Diffstat (limited to 'src')
-rw-r--r--src/modules/core/regex.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/modules/core/regex.js b/src/modules/core/regex.js
index 2b7b89e..b8adb83 100644
--- a/src/modules/core/regex.js
+++ b/src/modules/core/regex.js
@@ -8,7 +8,7 @@ export const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i
export const rgb = /rgb\((\d+),(\d+),(\d+)\)/
// Parse reference id
-export const reference = /(#[a-z0-9\-_]+)/i
+export const reference = /(#[a-z_][a-z0-9\-_]*)/i
// splits a transformation chain
export const transforms = /\)\s*,?\s*/
@@ -22,18 +22,12 @@ export const isHex = /^#[a-f0-9]{3,6}$/i
// Test rgb value
export const isRgb = /^rgb\(/
-// Test css declaration
-export const isCss = /[^:]+:[^;]+;?/
-
// Test for blank string
export const isBlank = /^(\s+)?$/
// Test for numeric string
export const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i
-// Test for percent value
-export const isPercent = /^-?[\d.]+%$/
-
// Test for image url
export const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i
@@ -42,7 +36,7 @@ export const delimiter = /[\s,]+/
// The following regex are used to parse the d attribute of a path
-// Matches all hyphens which are not after an exponent
+// Matches all hyphens which are preceeded by something but not an exponent
export const hyphen = /([^e])-/gi
// Replaces and tests for all path letters