MediaWiki REL1_31
|
A BalanceElement is a simplified version of a DOM Node. More...
Public Member Functions | |
__construct ( $namespaceURI, $localName, array $attribs) | |
Make a new BalanceElement corresponding to the HTML DOM Element with the given localname, namespace, and attributes. | |
__toString () | |
Serialize this node and all of its children to a string, as specified by the HTML serialization specification. | |
adoptChildren (BalanceElement $elt) | |
Transfer all of the children of $elt to $this. | |
appendChild ( $elt) | |
Append $elt to the end of the list of children. | |
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. | |
getNoahKey () | |
Get a string key for the Noah's Ark algorithm. | |
insertBefore (BalanceElement $a, $b) | |
Find $a in the list of children and insert $b before it. | |
isA ( $set) | |
Determine if $this represents a specific HTML tag, is a member of a tag set, or is equal to another BalanceElement. | |
isHtml () | |
Determine if $this represents an element in the HTML namespace. | |
isHtmlIntegrationPoint () | |
Determine if $this represents an HTML integration point, as defined in the HTML5 specification. | |
isHtmlNamed ( $tagName) | |
Determine if this element is an HTML element with the specified name. | |
isMathmlTextIntegrationPoint () | |
Determine if $this represents a MathML text integration point, as defined in the HTML5 specification. | |
Public Attributes | |
$attribs | |
Attributes for the element, in array form. | |
$children | |
An array of children of this element. | |
$localName | |
The lower-cased name of the element. | |
$namespaceURI | |
The namespace of the element. | |
$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. | |
$nextNoah | |
The next element in the Noah's Ark species bucket. | |
$parent | |
Parent of this element, or the string "flat" if this element has already been flattened into its parent. | |
$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. | |
Private Member Functions | |
removeChild (BalanceElement $elt) | |
Remove the given child from this element. | |
Private Attributes | |
$noahKey | |
A unique string identifier for Noah's Ark purposes, lazy initialized. | |
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.
Definition at line 316 of file Balancer.php.
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.
string | $namespaceURI | The namespace of the element. |
string | $localName | The lowercased name of the tag. |
array | $attribs | Attributes of the element |
Definition at line 379 of file Balancer.php.
References MediaWiki\Tidy\BalanceElement\$attribs, MediaWiki\Tidy\BalanceElement\$localName, MediaWiki\Tidy\BalanceElement\$namespaceURI, and contents.
MediaWiki\Tidy\BalanceElement::__toString | ( | ) |
Serialize this node and all of its children to a string, as specified by the HTML serialization specification.
Definition at line 533 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\$emptyElementSet, $out, $value, and MediaWiki\Tidy\BalanceElement\isA().
MediaWiki\Tidy\BalanceElement::adoptChildren | ( | BalanceElement | $elt | ) |
Transfer all of the children of $elt to $this.
BalanceElement | $elt |
Definition at line 452 of file Balancer.php.
References MediaWiki\Tidy\BalanceElement\appendChild().
MediaWiki\Tidy\BalanceElement::appendChild | ( | $elt | ) |
Append $elt to the end of the list of children.
BalanceElement | string | $elt |
Definition at line 432 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceElement\adoptChildren().
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.
array | $config | Balancer configuration; see Balancer::__construct(). |
Definition at line 477 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\$extraLinefeedSet, MediaWiki\Tidy\BalanceElement\isA(), and MediaWiki\Tidy\BalanceElement\isHtmlNamed().
MediaWiki\Tidy\BalanceElement::getNoahKey | ( | ) |
Get a string key for the Noah's Ark algorithm.
Definition at line 636 of file Balancer.php.
References MediaWiki\Tidy\BalanceElement\$attribs, MediaWiki\Tidy\BalanceElement\$noahKey, and serialize().
MediaWiki\Tidy\BalanceElement::insertBefore | ( | BalanceElement | $a, |
$b ) |
Find $a in the list of children and insert $b before it.
BalanceElement | $a | |
BalanceElement | string | $b |
Definition at line 410 of file Balancer.php.
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.
BalanceElement | array | string | $set | The target BalanceElement, set (from the BalanceSets class), or string (HTML tag name). |
Definition at line 567 of file Balancer.php.
References MediaWiki\Tidy\BalanceElement\isHtml().
Referenced by MediaWiki\Tidy\BalanceElement\__toString(), MediaWiki\Tidy\BalanceElement\flatten(), MediaWiki\Tidy\BalanceElement\isHtmlIntegrationPoint(), and MediaWiki\Tidy\BalanceElement\isMathmlTextIntegrationPoint().
MediaWiki\Tidy\BalanceElement::isHtml | ( | ) |
Determine if $this represents an element in the HTML namespace.
Definition at line 594 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\HTML_NAMESPACE.
Referenced by MediaWiki\Tidy\BalanceElement\isA().
MediaWiki\Tidy\BalanceElement::isHtmlIntegrationPoint | ( | ) |
Determine if $this represents an HTML integration point, as defined in the HTML5 specification.
Definition at line 616 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\$htmlIntegrationPointSet, MediaWiki\Tidy\BalanceElement\isA(), and MediaWiki\Tidy\BalanceSets\MATHML_NAMESPACE.
MediaWiki\Tidy\BalanceElement::isHtmlNamed | ( | $tagName | ) |
Determine if this element is an HTML element with the specified name.
string | $tagName |
Definition at line 584 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\HTML_NAMESPACE.
Referenced by MediaWiki\Tidy\BalanceElement\flatten(), and MediaWiki\Tidy\BalanceStack\fosterParent().
MediaWiki\Tidy\BalanceElement::isMathmlTextIntegrationPoint | ( | ) |
Determine if $this represents a MathML text integration point, as defined in the HTML5 specification.
Definition at line 605 of file Balancer.php.
References MediaWiki\Tidy\BalanceSets\$mathmlTextIntegrationPointSet, and MediaWiki\Tidy\BalanceElement\isA().
|
private |
Remove the given child from this element.
BalanceElement | $elt |
Definition at line 392 of file Balancer.php.
array MediaWiki\Tidy\BalanceElement::$attribs |
Attributes for the element, in array form.
Definition at line 331 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceElement\__construct(), and MediaWiki\Tidy\BalanceElement\getNoahKey().
BalanceElement[] string[] MediaWiki\Tidy\BalanceElement::$children |
An array of children of this element.
Typically only the last child will be an actual BalanceElement object; the rest will be strings, representing either text nodes or flattened BalanceElement objects.
Definition at line 347 of file Balancer.php.
string MediaWiki\Tidy\BalanceElement::$localName |
The lower-cased name of the element.
Definition at line 326 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceElement\__construct().
string MediaWiki\Tidy\BalanceElement::$namespaceURI |
The namespace of the element.
Definition at line 321 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceElement\__construct().
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.
Definition at line 358 of file Balancer.php.
MediaWiki\Tidy\BalanceElement::$nextNoah |
The next element in the Noah's Ark species bucket.
Definition at line 369 of file Balancer.php.
|
private |
A unique string identifier for Noah's Ark purposes, lazy initialized.
Definition at line 352 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceElement\getNoahKey().
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.
Definition at line 338 of file Balancer.php.
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.
Definition at line 364 of file Balancer.php.