StylePropertyMap:clear() 方法

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

StylePropertyMap 介面的 clear() 方法移除 StylePropertyMap 中的所有宣告。

語法

js
clear()

引數

無。

返回值

無(undefined)。

示例

以下示例移除了元素 style 屬性中的所有樣式。

js
// get the button element
const buttonEl = document.querySelector(".example");

// remove all styles from the style attribute
buttonEl.attributeStyleMap.clear();

規範

規範
CSS 型別化 OM Level 1
# dom-stylepropertymap-clear

瀏覽器相容性