StylePropertyMapReadOnly: phương thức values()

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Phương thức StylePropertyMapReadOnly.values() trả về một iterator mảng mới chứa các giá trị của mỗi chỉ mục trong đối tượng StylePropertyMapReadOnly.

Cú pháp

js
values()

Tham số

Không có.

Giá trị trả về

Một Array mới.

Ví dụ

Trong ví dụ này, sử dụng phương thức values() để truy cập các giá trị trong 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

Thông số kỹ thuật

Tính năng này dường như chưa được định nghĩa trong bất kỳ thông số kỹ thuật nào.

Tương thích trình duyệt