WP_HTML_Processor::step_in_head_noscript(): 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 by core. It is listed here for completeness.

Parses next element in the ‘in head noscript’ insertion mode.

Description

This internal function performs the ‘in head noscript’ insertion mode logic for the generalized WP_HTML_Processor::step() function.

See also

Return

bool Whether an element was found.

Source

/*
 * > A start tag whose tag name is "title"
 */
case '+TITLE':
	$this->insert_html_element( $this->state->current_token );
	return true;

/*
 * > A start tag whose tag name is "noscript", if the scripting flag is enabled
 * > A start tag whose tag name is one of: "noframes", "style"
 *
 * The scripting flag is never enabled in this parser.
 */
case '+NOFRAMES':
case '+STYLE':
	$this->insert_html_element( $this->state->current_token );
	return true;

/*
 * > A start tag whose tag name is "noscript", if the scripting flag is disabled
 */
case '+NOSCRIPT':
	$this->insert_html_element( $this->state->current_token );
	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_HEAD_NOSCRIPT;
	return true;

/*
 * > A start tag whose tag name is "script"
 *
 * @todo Could the adjusted insertion location be anything other than the current location?
 */
case '+SCRIPT':
	$this->insert_html_element( $this->state->current_token );
	return true;

/*
 * > An end tag whose tag name is "head"
 */
case '-HEAD':
	$this->state->stack_of_open_elements->pop();
	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_HEAD;
	return true;

/*
 * > An end tag whose tag name is one of: "body", "html", "br"
 *
 * 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 in_head_anything_else;
	break;

/*
 * > A start tag whose tag name is "template"
 *
 * @todo Could the adjusted insertion location be anything other than the current location?
 */
case '+TEMPLATE':
	$this->state->active_formatting_elements->insert_marker();
	$this->state->frameset_ok = false;

	$this->state->insertion_mode                      = WP_HTML_Processor_State::INSERTION_MODE_IN_TEMPLATE;
	$this->state->stack_of_template_insertion_modes[] = WP_HTML_Processor_State::INSERTION_MODE_IN_TEMPLATE;

	$this->insert_html_element( $this->state->current_token );
	return true;

/*
 * > An end tag whose tag name is "template"
 */
case '-TEMPLATE':
	if ( ! $this->state->stack_of_open_elements->contains( 'TEMPLATE' ) ) {
		// @todo Indicate a parse error once it's possible.
		return $this->step();
	}

	$this->generate_implied_end_tags_thoroughly();
	if ( ! $this->state->stack_of_open_elements->current_node_is( 'TEMPLATE' ) ) {
		// @todo Indicate a parse error once it's possible.
	}

	$this->state->stack_of_open_elements->pop_until( 'TEMPLATE' );
	$this->state->active_formatting_elements->clear_up_to_last_marker();

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

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

Sponsor
SponsoredKunjungi sekarang
Promo