@@ -6,7 +6,7 @@ | |||
* @copyright Wout Fierens <wout@woutfierens.com> | |||
* @license MIT | |||
* | |||
* BUILT: Thu Oct 20 2016 15:35:29 GMT-0200 (WGST) | |||
* BUILT: Thu Oct 20 2016 16:47:32 GMT-0200 (WGST) | |||
*/; | |||
(function(root, factory) { | |||
if (typeof define === 'function' && define.amd) { | |||
@@ -556,7 +556,7 @@ SVG.extend(SVG.PointArray, { | |||
if (Array.isArray(array)) return array | |||
// parse points | |||
array = array.split(/\s+|,/) | |||
array = array.trim().split(/\s+|,/) | |||
// validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints | |||
// Odd number of coordinates is an error. In such cases, drop the last odd coordinate. |
@@ -43,6 +43,11 @@ describe('PointArray', function () { | |||
expect(array + '').toBe('2176.6,1708.8 2176.4,1755.8 2245.8,1801.5 2297,1787.8') | |||
}) | |||
it('parses points with space delimitered x/y coordinates', function() { | |||
var array = new SVG.PointArray(' 1 2 3 ') | |||
expect(array + '').toBe('1,2,3') | |||
}) | |||
}) | |||
describe('PathArray', function () { |
@@ -48,7 +48,7 @@ SVG.extend(SVG.PointArray, { | |||
if (Array.isArray(array)) return array | |||
// parse points | |||
array = array.split(/\s+|,/) | |||
array = array.trim().split(/\s+|,/) | |||
// validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints | |||
// Odd number of coordinates is an error. In such cases, drop the last odd coordinate. |