WP_HTML_Open_Elements::has_element_in_specific_scope( string $tag_name, string[] $termination_list ): bool

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_namestringrequired
Name of tag check.
$termination_liststring[]required
List of elements that terminate the search.

Return

bool Whether the element was found in a specific scope.

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

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.