RemexHtml
Fast HTML 5 parser
Loading...
Searching...
No Matches
Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes Class Reference

An Attributes class for storing attributes on foreign elements, which may have namespaces. More...

+ Inheritance diagram for Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes:

Public Member Functions

 __construct (Attributes $unadjusted, $type)
 
 offsetExists ( $offset)
 
offsetGet ( $offset)
 
 offsetSet ( $offset, $value)
 
 offsetUnset ( $offset)
 
 getValues ()
 Get the attributes as a key/value array.
 
 count ()
 Get the number of attributes.
 
 getIterator ()
 
 getObjects ()
 Get the attributes as an array of Attribute objects.
 
 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.
 
 clone ()
 It's efficient to assume that attributes are immutable when cloning nodes due to AFE reconstruction or AAA.
 

Protected Attributes

Attributes $unadjusted
 
array $table
 The map of lowercase attribute name to correct attribute name *.
 
Attribute[] null $attrObjects
 

Detailed Description

An Attributes class for storing attributes on foreign elements, which may have namespaces.

Features lazy adjustment of attribute name case.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::__construct ( Attributes $unadjusted,
$type )
Parameters
Attributes$unadjustedThe unadjusted attributes from the Tokenizer
string$typeThe element type, which may be "math", "svg" or "other".

Member Function Documentation

◆ clone()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::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

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ count()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::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

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ getObjects()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::getObjects ( )

Get the attributes as an array of Attribute objects.

Returns
Attribute[]

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ getValues()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::getValues ( )

Get the attributes as a key/value array.

Returns
string[]

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ merge()

Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::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

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

Member Data Documentation

◆ $attrObjects

Attribute [] null Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::$attrObjects
protected

◆ $unadjusted

Attributes Wikimedia\RemexHtml\TreeBuilder\ForeignAttributes::$unadjusted
protected

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