StylePropertyMap: clear() method

Limited availability

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

Phương thức clear() của giao diện StylePropertyMap xóa tất cả các khai báo trong StylePropertyMap.

Cú pháp

js
clear()

Tham số

Không có.

Giá trị trả về

Không có (undefined).

Ví dụ

Ví dụ sau xóa tất cả các kiểu trong thuộc tính style của phần tử.

js
// lấy phần tử button
const buttonEl = document.querySelector(".example");

// xóa tất cả các kiểu từ thuộc tính style
buttonEl.attributeStyleMap.clear();

Thông số kỹ thuật

Specification
CSS Typed OM Level 1
# dom-stylepropertymap-clear

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