语法
js
clear()
参数
无。
返回值
无(undefined)。
异常
NoModificationAllowedErrorDOMException-
如果列表是只读的,则会抛出此错误。
示例
以下示例显示了一个包含 <polyline> 元素(具有五个坐标对)的 SVG。调用 clear() 会清空列表。因此,该折线将不再显示在 SVG 中。
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
let example = document.getElementById("example");
example.points.clear();
规范
| 规范 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGNameList__clear |
浏览器兼容性
加载中…