Skip to content

Polyfill that adds getTotalLength(), getPointAtLength(x), and more to SVGPathElement interface. This addresses missing APIs on browsers like IE11 or older.

License

Notifications You must be signed in to change notification settings

ThePedestrian/svg-path-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg-path-polyfill

Polyfill that adds getTotalLength(), getPointAtLength(x), and more to SVGPathElement interface. This addresses missing APIs on browsers like IE11 or older.

Furthermore, moving of the APIs is known to cause issues as pointed out by MDN:

In SVG 2 the getPathSegAtLength() and createSVGPathSeg* methods were removed and the pathLength property and the getTotalLength() and getPointAtLength() methods were moved to SVGGeometryElement.

This polyfill address these issues.

Usage

Web Browser
<!-- Regular -->
<script type="text/javascript" src="https://raw.githubusercontent.com/ThePedestrian/svg-path-polyfill/master/build/svg-path-polyfill.js"></script>

<!-- Minified version -->
<script type="text/javascript" src="https://raw.githubusercontent.com/ThePedestrian/svg-path-polyfill/master/build/svg-path-polyfill.min.js"></script>
Node
npm install --save-dev https://github.com/ThePedestrian/svg-path-polyfill

Credits

This project makes use of svg-path-properties library by Roger Rovira to compute the path lengths and various other properties.

License

MIT License

Copyright (c) 2019 Uffaz Nathaniel

About

Polyfill that adds getTotalLength(), getPointAtLength(x), and more to SVGPathElement interface. This addresses missing APIs on browsers like IE11 or older.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published