The SVGPointList
interface represents a list of SVGPoint
objects.
An SVGPointList
can be designated as read-only, which means that attempts to modify the object will result in an exception being thrown.
The SVGPointList
interface represents a list of SVGPoint
objects.
An SVGPointList
can be designated as read-only, which means that attempts to modify the object will result in an exception being thrown.
SVGPointList.length
Read only
Returns the number of points in the list.
SVGPointList.numberOfItems
Read only
Returns the number of points in the list.
SVGPointList.clear()
Removes all items in the list.
SVGPointList.initialize()
First removes all items in the list, then adds a single value to the list.
SVGPointList.getItem()
Gets an item from the list at a specified position.
SVGPointList.insertItemBefore()
Inserts an element into the list at a specified position.
SVGPointList.replaceItem()
Replaces an item in the list with a new item.
SVGPointList.removeItem()
Removes an item from the list.
SVGPointList.appendItem()
Adds an item to the end of the list.
The following example shows an SVG which contains a <polyline>
with five coordinate pairs. The points
property returns an SVGPointList
.
html
<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>
js
let example = document.getElementById("example"); console.log(example.points); //an SVGPointList
Specification |
---|
Scalable Vector Graphics (SVG) 2 # InterfaceSVGPointList |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
SVGPointList |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
appendItem |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
clear |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
getItem |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
initialize |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
insertItemBefore |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
length |
35 | 79 | 5 | No | ≤12.1 | 13.1 | 37 | 35 | 5 | ≤12.1 | 13.4 | 3.0 |
numberOfItems |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
removeItem |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
replaceItem |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGPointList