Returns whether an element is in a specific scope.
Description
HTML Support
This function skips checking for the termination list because there are no supported elements which appear in the termination list.
See also
Parameters
$tag_name
stringrequired- Name of tag check.
$termination_list
string[]required- List of elements that terminate the search.
Source
*
* @param int $nth Retrieve the nth item on the stack, with 1 being
* the top element, 2 being the second, etc...
* @return WP_HTML_Token|null Name of the node on the stack at the given location,
* or `null` if the location isn't on the stack.
*/
public function at( int $nth ): ?WP_HTML_Token {
foreach ( $this->walk_down() as $item ) {
if ( 0 === --$nth ) {
return $item;
}
}
return null;
}
/**
* Reports if a node of a given name is in the stack of open elements.
*
* @since 6.7.0
*
* @param string $node_name Name of node for which to check.
* @return bool Whether a node of the given name is in the stack of open elements.
*/
public function contains( string $node_name ): bool {
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.