WP_HTML_Processor::get_adjusted_current_node()privateWP 6.7.0

Returns the adjusted current node.

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.

Method of the class: WP_HTML_Processor{}

No Hooks.

Return

WP_HTML_Token|null. The adjusted current node.

Usage

// private - for code of main (parent) class only
$result = $this->get_adjusted_current_node(): ?WP_HTML_Token;

Notes

Changelog

Since 6.7.0 Introduced.

WP_HTML_Processor::get_adjusted_current_node() code WP 6.7.1

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();
}