WP_HTML_Tag_Processor::get_tag(): string|null

In this article

Returns the uppercase name of the matched tag.

Description

Example:

$p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
$p->next_tag() === true;
$p->get_tag() === 'DIV';

$p->next_tag() === false;
$p->get_tag() === null;

Return

string|null Name of currently matched tag in input HTML, or null if none found.

Source

	return null;
}

/*
 * Boolean attribute updates are just the attribute name without a corresponding value.
 *
 * This value might differ from the given comparable name in that there could be leading
 * or trailing whitespace, and that the casing follows the name given in `set_attribute`.
 *
 * Example:
 *
 *     $p->set_attribute( 'data-TEST-id', 'update' );
 *     'update' === $p->get_enqueued_attribute_value( 'data-test-id' );
 *
 * Detect this difference based on the absence of the `=`, which _must_ exist in any
 * attribute containing a value, e.g. `<input type="text" enabled />`.
 *                                            ¹           ²
 *                                       1. Attribute with a string value.
 *                                       2. Boolean attribute whose value is `true`.
 */

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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