Permalink
Browse files

#23 Path component string should be trimmed before processing

  • Loading branch information...
bjornd committed Jun 16, 2012
1 parent b5d6bb3 commit aabe3c9d45f7e39e44f762821c746e524ecf0b0b
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/vml-path-element.js
View
@@ -28,7 +28,10 @@ jvm.VMLPathElement.pathSvgToVml = function(path) {
path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
- coords = coords.replace(/(\d)-/g, '$1,-').replace(/\s+/g, ',').split(',');
+ coords = coords.replace(/(\d)-/g, '$1,-')
+ .replace(/^\s+/g, '')
+ .replace(/\s+$/g, '')
+ .replace(/\s+/g, ',').split(',');
if (!coords[0]) coords.shift();
for (var i=0, l=coords.length; i<l; i++) {
coords[i] = Math.round(100*coords[i]);

0 comments on commit aabe3c9

Please sign in to comment.