Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Utils\DOMCompat\TokenList Class Reference

Implements the parts of DOMTokenList interface which are used by Parsoid. More...

+ Inheritance diagram for Wikimedia\Parsoid\Utils\DOMCompat\TokenList:
+ Collaboration diagram for Wikimedia\Parsoid\Utils\DOMCompat\TokenList:

Public Member Functions

 __construct ( $node)
 
 getLength ()
 Return the number of CSS classes this element has.
 
 contains (string $token)
 Checks if the element has a given CSS class.
 
 add (string ... $tokens)
 Add CSS classes to the element.
 
 remove (string ... $tokens)
 Remove CSS classes from the element.
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 

Protected Attributes

 $node
 

Detailed Description

Implements the parts of DOMTokenList interface which are used by Parsoid.

Note
To improve performance, no effort is made to keep the TokenList in sync with the real class list if that is changed from elsewhere.
See also
https://dom.spec.whatwg.org/#interface-domtokenlist

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Utils\DOMCompat\TokenList::__construct ( $node)
Parameters
Element$nodeThe node whose classes are listed.

Member Function Documentation

◆ add()

Wikimedia\Parsoid\Utils\DOMCompat\TokenList::add ( string ... $tokens)

Add CSS classes to the element.

Parameters
string...$tokens List of classes to add
See also
https://dom.spec.whatwg.org/#dom-domtokenlist-add

◆ contains()

Wikimedia\Parsoid\Utils\DOMCompat\TokenList::contains ( string $token)

Checks if the element has a given CSS class.

Parameters
string$token
Returns
bool
See also
https://dom.spec.whatwg.org/#dom-domtokenlist-contains

◆ getLength()

Wikimedia\Parsoid\Utils\DOMCompat\TokenList::getLength ( )

Return the number of CSS classes this element has.

Returns
int
See also
https://dom.spec.whatwg.org/#dom-domtokenlist-length

◆ remove()

Wikimedia\Parsoid\Utils\DOMCompat\TokenList::remove ( string ... $tokens)

Remove CSS classes from the element.

Parameters
string...$tokens List of classes to remove
See also
https://dom.spec.whatwg.org/#dom-domtokenlist-remove

The documentation for this class was generated from the following file: