RemexHtml
Fast HTML 5 parser
Loading...
Searching...
No Matches
Wikimedia\RemexHtml\Tokenizer\Attributes Interface Reference

Interface for attributes emitted by the tokenizer. More...

+ Inheritance diagram for Wikimedia\RemexHtml\Tokenizer\Attributes:

Public Member Functions

string[] getValues ()
 Get the attributes as a key/value array.
 
Attribute[] getObjects ()
 Get the attributes as an array of Attribute objects.
 
int count ()
 Get the number of attributes.
 
 merge (Attributes $other)
 Add any attributes in the argument to $this, but if an attribute of the same name already exists, do not overwrite it.
 
Attributes clone ()
 It's efficient to assume that attributes are immutable when cloning nodes due to AFE reconstruction or AAA.
 

Detailed Description

Interface for attributes emitted by the tokenizer.

Member Function Documentation

◆ clone()

Attributes Wikimedia\RemexHtml\Tokenizer\Attributes::clone ( )

It's efficient to assume that attributes are immutable when cloning nodes due to AFE reconstruction or AAA.

So by default, this returns $this. But users can override it if attribute cloning needs special handling.

Returns
Attributes

Implemented in Wikimedia\RemexHtml\Tokenizer\LazyAttributes, Wikimedia\RemexHtml\Tokenizer\PlainAttributes, and Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes.

◆ count()

int Wikimedia\RemexHtml\Tokenizer\Attributes::count ( )

Get the number of attributes.

This may include duplicates, and so may be larger than count( $this->getValues() ). Including duplicates gives us an efficient way to distinguish zero attributes from non-zero but is not compliant with the spec, which states that duplicate attributes must be removed.

Returns
int

Implemented in Wikimedia\RemexHtml\Tokenizer\LazyAttributes, Wikimedia\RemexHtml\Tokenizer\PlainAttributes, and Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes.

◆ getObjects()

Attribute[] Wikimedia\RemexHtml\Tokenizer\Attributes::getObjects ( )

Get the attributes as an array of Attribute objects.

Returns
Attribute[]

Implemented in Wikimedia\RemexHtml\Tokenizer\LazyAttributes, Wikimedia\RemexHtml\Tokenizer\PlainAttributes, and Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes.

◆ getValues()

string[] Wikimedia\RemexHtml\Tokenizer\Attributes::getValues ( )

◆ merge()

Wikimedia\RemexHtml\Tokenizer\Attributes::merge ( Attributes $other)

Add any attributes in the argument to $this, but if an attribute of the same name already exists, do not overwrite it.

Parameters
Attributes$other

Implemented in Wikimedia\RemexHtml\Tokenizer\LazyAttributes, Wikimedia\RemexHtml\Tokenizer\PlainAttributes, and Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes.


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