SVGPointList

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.

Properties

SVGPointList.lengthRead only

Returns the number of points in the list.

SVGPointList.numberOfItemsRead only

Returns the number of points in the list.

Methods

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.

Examples

The following example shows an SVG which contains a <polyline> with five coordinate pairs. The points property returns an SVGPointList.

<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"/>
let example = document.getElementById("example");
console.log(example.points); //an SVGPointList

Specifications

Browser compatibility

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
≤4
≤37
18
4
≤12.1
≤3
1.0
appendItem
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
clear
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
getItem
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
initialize
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
insertItemBefore
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
length
35
79
5
No
≤12.1
13
37
35
5
≤12.1
13
3.0
numberOfItems
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
removeItem
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0
replaceItem
1
12
1.5
9
≤12.1
≤4
≤37
18
4
≤12.1
≤3
1.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGPointList