BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
MediaWiki\Tidy\BalanceElement Class Reference

Public Member Functions

 __construct ($namespaceURI, $localName, array $attribs)
 
 insertBefore (BalanceElement $a, $b)
 
 appendChild ($elt)
 
 adoptChildren (BalanceElement $elt)
 
 flatten (array $config)
 
 __toString ()
 
 isA ($set)
 
 isHtmlNamed ($tagName)
 
 isHtml ()
 
 isMathmlTextIntegrationPoint ()
 
 isHtmlIntegrationPoint ()
 
 getNoahKey ()
 

Public Attributes

 $namespaceURI
 
 $localName
 
 $attribs
 
 $parent
 
 $children
 
 $nextAFE
 
 $prevAFE
 
 $nextNoah
 

Detailed Description

A BalanceElement is a simplified version of a DOM Node. The main difference is that we only keep BalanceElements around for nodes currently on the BalanceStack of open elements. As soon as an element is closed, with some minor exceptions relating to the tree builder "adoption agency algorithm", the element and all its children are serialized to a string using the flatten() method. This keeps our memory usage low.

Since
1.27

Constructor & Destructor Documentation

MediaWiki\Tidy\BalanceElement::__construct (   $namespaceURI,
  $localName,
array  $attribs 
)

Make a new BalanceElement corresponding to the HTML DOM Element with the given localname, namespace, and attributes.

Parameters
string$namespaceURIThe namespace of the element.
string$localNameThe lowercased name of the tag.
array$attribsAttributes of the element

Member Function Documentation

MediaWiki\Tidy\BalanceElement::__toString ( )

Serialize this node and all of its children to a string, as specified by the HTML serialization specification.

Returns
string The serialization of the BalanceElement
See Also
https://html.spec.whatwg.org/multipage/syntax.html#serialising-html-fragments
MediaWiki\Tidy\BalanceElement::adoptChildren ( BalanceElement  $elt)

Transfer all of the children of $elt to $this.

Parameters
BalanceElement$elt
MediaWiki\Tidy\BalanceElement::appendChild (   $elt)

Append $elt to the end of the list of children.

Parameters
BalanceElement | string$elt
MediaWiki\Tidy\BalanceElement::flatten ( array  $config)

Flatten this node and all of its children into a string, as specified by the HTML serialization specification, and replace this node in its parent by that string.

Parameters
array$configBalancer configuration; see Balancer::__construct().
Returns
string
See Also
__toString()
MediaWiki\Tidy\BalanceElement::getNoahKey ( )

Get a string key for the Noah's Ark algorithm

Returns
string
MediaWiki\Tidy\BalanceElement::insertBefore ( BalanceElement  $a,
  $b 
)

Find $a in the list of children and insert $b before it.

Parameters
BalanceElement$a
BalanceElement | string$b
MediaWiki\Tidy\BalanceElement::isA (   $set)

Determine if $this represents a specific HTML tag, is a member of a tag set, or is equal to another BalanceElement.

Parameters
BalanceElement | array | string$setThe target BalanceElement, set (from the BalanceSets class), or string (HTML tag name).
Returns
bool
MediaWiki\Tidy\BalanceElement::isHtml ( )

Determine if $this represents an element in the HTML namespace.

Returns
bool
MediaWiki\Tidy\BalanceElement::isHtmlIntegrationPoint ( )

Determine if $this represents an HTML integration point, as defined in the HTML5 specification.

Returns
bool
See Also
https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
MediaWiki\Tidy\BalanceElement::isHtmlNamed (   $tagName)

Determine if this element is an HTML element with the specified name

Parameters
string$tagName
Returns
bool
MediaWiki\Tidy\BalanceElement::isMathmlTextIntegrationPoint ( )

Determine if $this represents a MathML text integration point, as defined in the HTML5 specification.

Returns
bool
See Also
https://html.spec.whatwg.org/multipage/syntax.html#mathml-text-integration-point

Member Data Documentation

array MediaWiki\Tidy\BalanceElement::$attribs

Attributes for the element, in array form

string MediaWiki\Tidy\BalanceElement::$localName

The lower-cased name of the element.

string MediaWiki\Tidy\BalanceElement::$namespaceURI

The namespace of the element.

MediaWiki\Tidy\BalanceElement::$nextAFE

The next active formatting element in the list, or null if this is the end of the AFE list or if the element is not in the AFE list.

MediaWiki\Tidy\BalanceElement::$nextNoah

The next element in the Noah's Ark species bucket.

BalanceElement string null MediaWiki\Tidy\BalanceElement::$parent

Parent of this element, or the string "flat" if this element has already been flattened into its parent.

MediaWiki\Tidy\BalanceElement::$prevAFE

The previous active formatting element in the list, or null if this is the start of the list or if the element is not in the AFE list.


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