WP_HTML_Processor::get_adjusted_current_node(): WP_HTML_Token|null

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/#adjusted-current-node instead.

Returns the adjusted current node.

Description

The adjusted current node is the context element if the parser was created as part of the HTML fragment parsing algorithm and the stack of open elements has only one element in it (fragment case); otherwise, the adjusted current node is the current node.

See also

Return

WP_HTML_Token|null The adjusted current node.

Source

private function get_adjusted_current_node(): ?WP_HTML_Token {
	if ( isset( $this->context_node ) && 1 === $this->state->stack_of_open_elements->count() ) {
		return $this->context_node;
	}

	return $this->state->stack_of_open_elements->current_node();
}

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

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