Last active
August 29, 2015 14:04
-
-
Save hnakamur/bc26a6fa7d7b8d9dc795 to your computer and use it in GitHub Desktop.
Firefox hangs with SVG path getTotalLength for some path with two cubic bezier segments. try http://bl.ocks.org/hnakamur/bc26a6fa7d7b8d9dc795
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta charset='utf-8'> | |
</head> | |
<body> | |
<div id='example'> | |
<svg width="300" height="300"> | |
<path id="path1" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" stroke="black" fill="none"/> | |
<path id="path2" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/> | |
<path id="path3" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/> | |
</svg> | |
</div> | |
<script> | |
var n = 3, i, path; | |
for (i = 1; i <= n; i++) { | |
path = document.getElementById('path' + i); | |
if (path) { | |
console.log('path' + i, path); | |
console.log('path' + i + '.length', path.getTotalLength()); | |
} | |
} | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chrome 36.0.1985.125 | |
path1.length 68.57687377929688 | |
path2.length 51.637718200683594 | |
path3.length 120.21459197998047 | |
Safari 6.1.5 (8537.77.4) | |
path1.length 68.57698059082031 | |
path2.length 51.63789749145508 | |
path3.length 120.21487426757812 | |
Firefox 31.0 | |
path1.length 0 # wrong! | |
path2.length 123295481856 # wrong! | |
path3.length Firefox hangs! | |
Firefox Nightly 34.0a1 (2014-07-25) | |
path1.length 0 # wrong! | |
path2.length 123295481856 # wrong! | |
path3.length Firefox hangs! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment