WP_HTML_Tag_Processor::seek( string $bookmark_name ): bool

In this article

Move the internal cursor in the Tag Processor to a given bookmark’s location.

Description

In order to prevent accidental infinite loops, there’s a maximum limit on the number of times seek() can be called.

Parameters

$bookmark_namestringrequired
Jump to the place in the document identified by this bookmark name.

Return

bool Whether the internal cursor was successfully moved to the bookmark’s location.

Source


	/*
	 * Otherwise, append it to the new "class" attribute value.
	 *
	 * There are options for handling whitespace between tags.
	 * Preserving the existing whitespace produces fewer changes
	 * to the HTML content and should clarify the before/after
	 * content when debugging the modified output.
	 *
	 * This approach contrasts normalizing the inter-class
	 * whitespace to a single space, which might appear cleaner
	 * in the output HTML but produce a noisier change.
	 */
	if ( '' !== $class ) {
		$class .= substr( $existing_class, $ws_at, $ws_length );
	}
	$class .= $name;
}

// Add new classes by appending those which haven't already been seen.
foreach ( $this->classname_updates as $name => $operation ) {
	$comparable_name = $is_quirks ? strtolower( $name ) : $name;
	if ( self::ADD_CLASS === $operation && ! in_array( $comparable_name, $seen, true ) ) {
		$modified = true;

		$class .= strlen( $class ) > 0 ? ' ' : '';
		$class .= $name;

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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