API / Minn\Html\Tree / OpenElements

OpenElements final class

Minn\Html\Tree\OpenElements · public/minn/src/Minn/Html/Tree/OpenElements.php · 110 lines

The stack of open elements and the spec's scope tests over it: an element is in scope when it is reached walking down from the current node before any of the scope's boundary elements.

Uses 1

Constants and properties

privateDEFAULT_SCOPE = array ( 'html' => array ( 0 => 'APPLET', 1 => 'CAPTION', 2 => 'HTML', 3 => 'TABLE', 4 => 'TD', 5 => 'TH', 6 => 'MARQUEE', 7 => 'OBJECT', 8 => 'TEMPLATE', ), 'math' => array ( 0 => 'MI', 1 => 'MO', 2 => 'MN', 3 => 'MS', 4 => 'MTEXT', 5 => 'ANNOTATION-XML', ), 'svg' => array ( 0 => 'FOREIGNOBJECT', 1 => 'DESC', 2 => 'TITLE', ), )
privatearray $nodes

Public

methodpush(Minn\Html\Tree\Node $node): void#

Puts a node on top.

methodpop(): ?Minn\Html\Tree\Node#

Takes the current node off, or null when the stack is empty.

methodcurrent(): ?Minn\Html\Tree\Node#

The current (bottom-most open) node.

methodat(int $index): ?Minn\Html\Tree\Node#

The node at a position, 0 being the root.

methodcount(): int#

How many nodes are open.

methodall(): array#

Every open node, root first.

@return list<Node>
methodcontainsNode(Minn\Html\Tree\Node $node): bool#

Whether this very node is open.

methodhasHtml(string $name): bool#

Whether an HTML element of the name is open anywhere.

methodinScope(string ...$names): bool#

Whether one of the HTML elements is in the default scope.

methodinListItemScope(string $name): bool#

Whether the HTML element is in list item scope (the default plus OL and UL).

methodinButtonScope(string $name): bool#

Whether the HTML element is in button scope (the default plus BUTTON).

methodinTableScope(string ...$names): bool#

Whether one of the HTML elements is in table scope (HTML, TABLE and TEMPLATE bound it).

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateinSpecificScope(array $names, array $boundary): bool#
$nameslist<string>
$boundaryarray<string, list<string>>