diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-09-03 10:49:11 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-09-03 10:49:11 +0200 |
commit | 06ac034aee7f00f99aec4b55f4a2386371cb5794 (patch) | |
tree | 4ac7f1c86defc99876d4b3c4cd7d4465e10c6641 /src | |
parent | ca8ac554bfafe6b4d7985fe3130ff3dffa6029ca (diff) | |
download | svg.js-06ac034aee7f00f99aec4b55f4a2386371cb5794.tar.gz svg.js-06ac034aee7f00f99aec4b55f4a2386371cb5794.zip |
allow + as delemiter in paths (fixes #1165)
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/pathParser.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/pathParser.js b/src/utils/pathParser.js index 6d3f4e2..2b97add 100644 --- a/src/utils/pathParser.js +++ b/src/utils/pathParser.js @@ -152,6 +152,7 @@ function isExponential(parser) { return parser.lastToken.toUpperCase() === 'E' } +const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f']) export function pathParser(d, toAbsolute = true) { let index = 0 let token = '' @@ -201,14 +202,14 @@ export function pathParser(d, toAbsolute = true) { continue } - if (token === ' ' || token === ',') { + if (pathDelimiters.has(token)) { if (parser.inNumber) { finalizeNumber(parser, false) } continue } - if (token === '-') { + if (token === '-' || token === '+') { if (parser.inNumber && !isExponential(parser)) { finalizeNumber(parser, false) --index |