WP_HTML_Open_Elements::has_element_in_list_item_scopepublicWP 6.4.0

Returns whether a particular element is in list item scope.

The stack of open elements is said to have a particular element > in list item scope when it has that element in the specific scope > consisting of the following element types: > > - All the element types listed above for the has an element in scope algorithm. > - ol in the HTML namespace > - ul in the HTML namespace

Method of the class: WP_HTML_Open_Elements{}

No Hooks.

Returns

true|false. Whether given element is in scope.

Usage

$WP_HTML_Open_Elements = new WP_HTML_Open_Elements();
$WP_HTML_Open_Elements->has_element_in_list_item_scope( $tag_name ): bool;
$tag_name(string) (required)
Name of tag to check.

Notes

Changelog

Since 6.4.0 Introduced.
Since 6.5.0 Implemented: no longer throws on every invocation.
Since 6.7.0 Supports all required HTML elements.

WP_HTML_Open_Elements::has_element_in_list_item_scope() code WP 6.8.1

public function has_element_in_list_item_scope( string $tag_name ): bool {
	return $this->has_element_in_specific_scope(
		$tag_name,
		array(
			'APPLET',
			'BUTTON',
			'CAPTION',
			'HTML',
			'TABLE',
			'TD',
			'TH',
			'MARQUEE',
			'OBJECT',
			'OL',
			'TEMPLATE',
			'UL',

			'math MI',
			'math MO',
			'math MN',
			'math MS',
			'math MTEXT',
			'math ANNOTATION-XML',

			'svg FOREIGNOBJECT',
			'svg DESC',
			'svg TITLE',
		)
	);
}