RemexHtml
Fast HTML 5 parser
|
An implementation of the "stack of open elements" which includes a cache of elements currently in the various kinds of scope. More...
Public Member Functions | |
push (Element $elt) | |
Push an element. | |
pop () | |
Pop an element from the stack. | |
replace (Element $oldElt, Element $elt) | |
Replace an element which is on the stack with another element of the same type (i.e. | |
remove (Element $elt) | |
Remove an element, potentially from the middle of the stack. | |
isInScope ( $name) | |
Is there an element in (default) scope which is in the HTML namespace and has the given tag name? | |
isElementInScope (Element $elt) | |
Is the given element in (default) scope? | |
isOneOfSetInScope ( $names) | |
Is there any element in the (default) scope which is in the HTML namespace and has one of the given tag names? | |
isInListScope ( $name) | |
Is there an element in list scope which is an HTML element with the given name? | |
isInButtonScope ( $name) | |
Is there an element in button scope which is an HTML element with the given name? | |
isInTableScope ( $name) | |
Is there an element in table scope which is an HTML element with the given name? | |
isInSelectScope ( $name) | |
Is there an element in select scope which is an HTML element with the given name? | |
item ( $idx) | |
Get an element from the stack, where 0 is the first element inserted, and $this->length() - 1 is the most recently inserted element. | |
length () | |
Get the number of elements in the stack. | |
hasTemplate () | |
Is there a template element in the stack of open elements? | |
dump () | |
Get a string representation of the stack for debugging purposes. | |
Additional Inherited Members | |
Public Attributes inherited from Wikimedia\RemexHtml\TreeBuilder\Stack | |
$current | |
An implementation of the "stack of open elements" which includes a cache of elements currently in the various kinds of scope.
It presumably has good worst-case performance at the expense of somewhat slower updates.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::dump | ( | ) |
Get a string representation of the stack for debugging purposes.
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::hasTemplate | ( | ) |
Is there a template element in the stack of open elements?
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isElementInScope | ( | Element | $elt | ) |
Is the given element in (default) scope?
Element | $elt |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isInButtonScope | ( | $name | ) |
Is there an element in button scope which is an HTML element with the given name?
string | $name |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isInListScope | ( | $name | ) |
Is there an element in list scope which is an HTML element with the given name?
string | $name |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isInScope | ( | $name | ) |
Is there an element in (default) scope which is in the HTML namespace and has the given tag name?
string | $name |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isInSelectScope | ( | $name | ) |
Is there an element in select scope which is an HTML element with the given name?
string | $name |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isInTableScope | ( | $name | ) |
Is there an element in table scope which is an HTML element with the given name?
string | $name |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::isOneOfSetInScope | ( | $names | ) |
Is there any element in the (default) scope which is in the HTML namespace and has one of the given tag names?
array<string,mixed> | $names An array with the tag names in the keys, the value arbitrary |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::item | ( | $idx | ) |
Get an element from the stack, where 0 is the first element inserted, and $this->length() - 1 is the most recently inserted element.
This will raise a PHP notice if the index is out of range.
int | $idx |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::length | ( | ) |
Get the number of elements in the stack.
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::pop | ( | ) |
Pop an element from the stack.
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Wikimedia\RemexHtml\TreeBuilder\CachingStack::push | ( | Element | $elt | ) |
Wikimedia\RemexHtml\TreeBuilder\CachingStack::remove | ( | Element | $elt | ) |
Remove an element, potentially from the middle of the stack.
Element | $elt |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.
Replace an element which is on the stack with another element of the same type (i.e.
with the same tag name).
Element | $old | The element to be removed |
Element | $new | The element to be inserted |
Reimplemented from Wikimedia\RemexHtml\TreeBuilder\Stack.