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

The parent class for the "stack of open elements". More...

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

Public Member Functions

 push (Element $elt)
 Push an element.
 
Element null pop ()
 Pop an element from the stack.
 
 replace (Element $old, Element $new)
 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.
 
bool isInScope ( $name)
 Is there an element in (default) scope which is in the HTML namespace and has the given tag name?
 
bool isElementInScope (Element $elt)
 Is the given element in (default) scope?
 
bool isOneOfSetInScope ( $names)
 Is there any element in the (default) scope which is in the HTML namespace and has one of the given tag names?
 
bool isInListScope ( $name)
 Is there an element in list scope which is an HTML element with the given name?
 
bool isInButtonScope ( $name)
 Is there an element in button scope which is an HTML element with the given name?
 
bool isInTableScope ( $name)
 Is there an element in table scope which is an HTML element with the given name?
 
bool isInSelectScope ( $name)
 Is there an element in select scope which is an HTML element with the given name?
 
Element null 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.
 
int length ()
 Get the number of elements in the stack.
 
bool hasTemplate ()
 Is there a template element in the stack of open elements?
 
string dump ()
 Get a string representation of the stack for debugging purposes.
 

Public Attributes

 $current
 

Detailed Description

The parent class for the "stack of open elements".

See also
CachingStack
SimpleStack

Member Function Documentation

◆ dump()

string Wikimedia\RemexHtml\TreeBuilder\Stack::dump ( )

Get a string representation of the stack for debugging purposes.

Returns
string

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack.

◆ hasTemplate()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::hasTemplate ( )
abstract

Is there a template element in the stack of open elements?

Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isElementInScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isElementInScope ( Element $elt)
abstract

Is the given element in (default) scope?

Parameters
Element$elt
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isInButtonScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isInButtonScope ( $name)
abstract

Is there an element in button scope which is an HTML element with the given name?

Parameters
string$name
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isInListScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isInListScope ( $name)
abstract

Is there an element in list scope which is an HTML element with the given name?

Parameters
string$name
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isInScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isInScope ( $name)
abstract

Is there an element in (default) scope which is in the HTML namespace and has the given tag name?

Parameters
string$name
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isInSelectScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isInSelectScope ( $name)
abstract

Is there an element in select scope which is an HTML element with the given name?

Parameters
string$name
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isInTableScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isInTableScope ( $name)
abstract

Is there an element in table scope which is an HTML element with the given name?

Parameters
string$name
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ isOneOfSetInScope()

bool Wikimedia\RemexHtml\TreeBuilder\Stack::isOneOfSetInScope ( $names)
abstract

Is there any element in the (default) scope which is in the HTML namespace and has one of the given tag names?

Parameters
array<string,mixed>$names An array with the tag names in the keys, the value arbitrary
Returns
bool

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ item()

Element null Wikimedia\RemexHtml\TreeBuilder\Stack::item ( $idx)
abstract

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.

Parameters
int$idx
Returns
Element|null

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ length()

int Wikimedia\RemexHtml\TreeBuilder\Stack::length ( )
abstract

Get the number of elements in the stack.

Returns
int

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ pop()

Element null Wikimedia\RemexHtml\TreeBuilder\Stack::pop ( )
abstract

Pop an element from the stack.

Returns
Element|null

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ push()

Wikimedia\RemexHtml\TreeBuilder\Stack::push ( Element $elt)
abstract

Push an element.

Parameters
Element$elt

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ remove()

Wikimedia\RemexHtml\TreeBuilder\Stack::remove ( Element $elt)
abstract

Remove an element, potentially from the middle of the stack.

Parameters
Element$elt

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.

◆ replace()

Wikimedia\RemexHtml\TreeBuilder\Stack::replace ( Element $old,
Element $new )
abstract

Replace an element which is on the stack with another element of the same type (i.e.

with the same tag name).

Parameters
Element$oldThe element to be removed
Element$newThe element to be inserted

Reimplemented in Wikimedia\RemexHtml\TreeBuilder\CachingStack, and Wikimedia\RemexHtml\TreeBuilder\SimpleStack.


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