WP_HTML_Processor::is_special( string $tag_name ): bool

Returns whether an element of a given name is in the HTML special category.

Description

See also

Parameters

$tag_namestringrequired
Name of element to check.

Return

bool Whether the element of the given name is in the special category.

Source

	 * > element (the second element) on the stack of open elements, and if it is
	 * > not, add the attribute and its corresponding value to that element.
	 *
	 * This parser does not currently support this behavior: ignore the token.
	 */
	$this->state->frameset_ok = false;
	return $this->step();

/*
 * > A start tag whose tag name is "frameset"
 *
 * This tag in the IN BODY insertion mode is a parse error.
 */
case '+FRAMESET':
	if (
		1 === $this->state->stack_of_open_elements->count() ||
		'BODY' !== ( $this->state->stack_of_open_elements->at( 2 )->node_name ?? null ) ||
		false === $this->state->frameset_ok
	) {
		// Ignore the token.
		return $this->step();
	}

	/*
	 * > Otherwise, run the following steps:
	 */
	$this->bail( 'Cannot process non-ignored FRAMESET tags.' );
	break;

/*
 * > An end tag whose tag name is "body"
 */
case '-BODY':
	if ( ! $this->state->stack_of_open_elements->has_element_in_scope( 'BODY' ) ) {
		// Parse error: ignore the token.
		return $this->step();
	}

	/*
	 * > Otherwise, if there is a node in the stack of open elements that is not either a
	 * > dd element, a dt element, an li element, an optgroup element, an option element,
	 * > a p element, an rb element, an rp element, an rt element, an rtc element, a tbody
	 * > element, a td element, a tfoot element, a th element, a thread element, a tr
	 * > element, the body element, or the html element, then this is a parse error.
	 *
	 * There is nothing to do for this parse error, so don't check for it.
	 */

	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_BODY;
	/*
	 * The BODY element is not removed from the stack of open elements.
	 * Only internal state has changed, this does not qualify as a "step"
	 * in terms of advancing through the document to another token.
	 * Nothing has been pushed or popped.
	 * Proceed to parse the next item.
	 */
	return $this->step();

/*
 * > An end tag whose tag name is "html"
 */
case '-HTML':
	if ( ! $this->state->stack_of_open_elements->has_element_in_scope( 'BODY' ) ) {
		// Parse error: ignore the token.
		return $this->step();
	}

	/*
	 * > Otherwise, if there is a node in the stack of open elements that is not either a
	 * > dd element, a dt element, an li element, an optgroup element, an option element,
	 * > a p element, an rb element, an rp element, an rt element, an rtc element, a tbody
	 * > element, a td element, a tfoot element, a th element, a thread element, a tr
	 * > element, the body element, or the html element, then this is a parse error.
	 *
	 * There is nothing to do for this parse error, so don't check for it.
	 */

	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_BODY;
	return $this->step( self::REPROCESS_CURRENT_NODE );

/*
 * > A start tag whose tag name is one of: "address", "article", "aside",
 * > "blockquote", "center", "details", "dialog", "dir", "div", "dl",
 * > "fieldset", "figcaption", "figure", "footer", "header", "hgroup",
 * > "main", "menu", "nav", "ol", "p", "search", "section", "summary", "ul"
 */
case '+ADDRESS':
case '+ARTICLE':
case '+ASIDE':
case '+BLOCKQUOTE':
case '+CENTER':
case '+DETAILS':
case '+DIALOG':
case '+DIR':
case '+DIV':
case '+DL':
case '+FIELDSET':
case '+FIGCAPTION':
case '+FIGURE':
case '+FOOTER':
case '+HEADER':
case '+HGROUP':

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

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