StylePropertyMapReadOnly: values() 方法
StylePropertyMapReadOnly.values() 方法返回一個新的陣列迭代器,其中包含 StylePropertyMapReadOnly 物件中每個索引的值。
語法
js
values()
引數
無。
返回值
一個新的 Array。
示例
在這個例子中,我們使用 values() 方法來訪問 Element.computedStyleMap() 中的值。
js
// get a button element
const buttonEl = document.querySelector("button");
// we can retrieve all computed styles with `computedStyleMap`
const allComputedStyles = buttonEl.computedStyleMap();
// values returns an iterable list of the CSS values
const vals = allComputedStyles.values();
console.log(vals.next().value); // returns a CSSStyleValue
規範
此特性似乎未在任何規範中定義。瀏覽器相容性
載入中…