How to normalize SVG path data (cross browser)?

Posted by Timo on Stack Overflow See other posts from Stack Overflow or by Timo
Published on 2012-10-19T15:24:06Z Indexed on 2012/10/23 17:01 UTC
Read the original article Hit count: 144

Filed under:
|
|

I have tried to find a way to implement cross browser path normalizer. There IS a native way which is described here and functional example is here, but it works only in newest Opera (but not in IE, FF, Safari, Chrome).

The native way uses pathElm.normalizedPathSegList and it converts all relative coordinates to absolute ones and represents all path segment types as a following subset of types: M,L,C,z.

I have found only one javascript code and jsfiddled functional example of it, but it works only in IE and FF. Chrome gives "Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1". How this could be fixed to work also in Opera, Safari and Chrome or is there any other way for normalizing SVG paths?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about path