WP_HTML_Processor::reconstruct_active_formatting_elements(): bool

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use https://html.spec.whatwg.org/#reconstruct-the-active-formatting-elements instead.

Reconstructs the active formatting elements.

Description

This has the effect of reopening all the formatting elements that were opened in the current body, cell, or caption (whichever is youngest) that haven’t been explicitly closed.

See also

Return

bool Whether any formatting elements needed to be reconstructed.

Source

	/*
	 * > Push the node pointed to by the head element pointer onto the stack of open elements.
	 * > Process the token using the rules for the "in head" insertion mode.
	 * > Remove the node pointed to by the head element pointer from the stack of open elements. (It might not be the current node at this point.)
	 */
	$this->bail( 'Cannot process elements after HEAD which reopen the HEAD element.' );
	/*
	 * Do not leave this break in when adding support; it's here to prevent
	 * WPCS from getting confused at the switch structure without a return,
	 * because it doesn't know that `bail()` always throws.
	 */
	break;

/*
 * > An end tag whose tag name is "template"
 */
case '-TEMPLATE':
	return $this->step_in_head();

/*
 * > An end tag whose tag name is one of: "body", "html", "br"
 *
 * Closing BR tags are always reported by the Tag Processor as opening tags.
 */
case '-BODY':
case '-HTML':
	/*
	 * > Act as described in the "anything else" entry below.
	 */
	goto after_head_anything_else;
	break;

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

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