HTML DOMTokenList supports() Method

Definition and Usage

If the token in the DOMTokenList is one of the attribute-supported tokens, the supports() method returns true.

Example

Example 1

Check if "allow-forms" is supported:

const list = element.sandbox;
list.supports("allow-forms");

Try It Yourself

Example 2

Check if "allow-nonsense" is supported:

const list = element.sandbox;
list.supports("allow-nonsense");

Try It Yourself

Syntax

domtokenlist.supports(Token)

Parameter

Parameter Description
Token Required. The tag to be checked.

Return Value

Type Description
Boolean Value If the tag is supported, it returns true; otherwise, it returns false.

Browser Support

domtokenlist.supports() is a DOM Level 4 (2015) feature.

It is supported by all browsers:

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Internet Explorer 11 (or earlier versions) does not support domtokenlist.supports().

Related Pages

length Property

item() Method

add() Method

remove() Method

toggle() Method

replace() Method

forEach() Method

entries() Method

keys() Method

values() Method

DOMTokenList Object