StylePropertyMap: clear() method

Baseline 2026
Newly available

Since November 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Want more browser support for this feature? Tell us why.

The clear() method of the StylePropertyMap interface removes all declarations in the StylePropertyMap.

Syntax

js
clear()

Parameters

None.

Return value

None (undefined).

Examples

Basic usage

The following example removes all styles within the elements style attribute.

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

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

Specifications

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

Browser compatibility