A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/DOMTokenList/contains below:

contains ยท WebPlatform Docs

contains Summary

Tests if a token is part of a DOMTokenList.

Method of dom/DOMTokenListdom/DOMTokenList

Syntax
var tokenExists = tokenList.contains(token);
Parameters token
Data-type
String

The requested token.

Return Value

Returns an object of type BooleanBoolean

Whether the given token exists in the list. Returns true if the token is present; false otherwise.

Examples

function elHasClass(elid, cls) {
  var classes = document.getElementById(elid).classList;
  if (classes.contains(cls))
    return true;
  else
    return false;
}
Notes

Throws a SyntaxError exception if token is empty.

Throws an InvalidCharacterError exception if token contains any spaces.

Related specifications
W3C DOM4
Candidate Recommendation
See also Related pages Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4