語法
js
removeItem(index)
引數
index-
要移除的專案的索引。
返回值
被移除的 DOMPoint 物件。
異常
NoModificationAllowedErrorDOMException-
如果列表是隻讀的,則會丟擲此錯誤。
IndexSizeErrorDOMException-
如果傳入的索引大於列表中的項數,則會丟擲此異常。
示例
下面的示例展示了一個包含五個座標對的 <polyline> 的 SVG。索引為 2 的專案被移除。
html
<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>
js
const example = document.getElementById("example");
console.log(example.points.removeItem(2));
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGNameList__removeItem |
瀏覽器相容性
載入中…