WP_HTML_Open_Elements::has_element_in_scope( string $tag_name ): bool

Returns whether a particular element is in scope.

Description

The stack of open elements is said to have a particular element in scope when it has that element in the specific scope consisting of the following element types:

  • applet
  • caption
  • html
  • table
  • td
  • th
  • marquee
  • object
  • template
  • MathML mi
  • MathML mo
  • MathML mn
  • MathML ms
  • MathML mtext
  • MathML annotation-xml
  • SVG foreignObject
  • SVG desc
  • SVG title

See also

Parameters

$tag_namestringrequired
Name of tag to check.

Return

bool Whether given element is in scope.

Source

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

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

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

Changelog

VersionDescription
6.7.0Full support.
6.4.0Introduced.

User Contributed Notes

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