This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2020.
The length read-only property of the SVGPointList interface returns the number of items in the list.
The number of items in the list.
The following example shows an SVG which contains a <polyline> with five coordinate pairs. The length property returns 5.
<svg id="svg" viewBox="-10 -10 120 120" xmlns="http://www.w3.org/2000/svg">
<polyline
id="example"
stroke="black"
fill="none"
points="50,0 21,90 98,35 2,35 79,90" />
</svg>
let example = document.getElementById("example");
console.log(example.points.length); // 5
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
length |
35 | 79 | 5 | ≤12.1 | 13.1 | 35 | 5 | ≤12.1 | 13.4 | 3.0 | 37 | 13.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGPointList/length