StylePropertyMap.clear()

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

Syntax

StylePropertMap.clear()

Parameters

None.

Return value

Example

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

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

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

Specifications

Specification Status Comment
CSS Typed OM Level 1
The definition of 'clear()' in that specification.
Working Draft Initial definition.

Browser compatibility

BCD tables only load in the browser