WP_HTML_Open_Elements::contains │ public │ WP 6.7.0

Reports if an HTML element of a given name is on the stack of open elements.

Метод класса: WP_HTML_Open_Elements{}

Хуков нет.

Возвращает

bool. Whether a node of the given name is in the stack of open elements.

Использование

$WP_HTML_Open_Elements = new WP_HTML_Open_Elements();
$WP_HTML_Open_Elements->contains( $node_name ): bool;
$node_name(строка) (обязательный)
Name of HTML element for which to check.

Список изменений

С версии 6.7.0 Введена.

Код WP_HTML_Open_Elements::contains() WP 7.1.3

public function contains( string $node_name ): bool {
	foreach ( $this->walk_up() as $item ) {
		if ( 'html' === $item->namespace && $node_name === $item->node_name ) {
			return true;
		}
	}

	return false;
}