Gets lowercase names of all attributes matching a given prefix in the current tag.
Note that matching is case-insensitive. This is in accordance with the spec:
There must never be two or more attributes on the same start tag whose names are an ASCII case-insensitive match for each other.
- HTML 5 spec
Example:
$p = new WP_HTML_Tag_Processor( '<div data-ENABLED class="test" DATA-test-id="14">Test</div>' );
$p->next_tag( array( 'class_name' => 'test' ) ) === true;
$p->get_attribute_names_with_prefix( 'data-' ) === array( 'data-enabled', 'data-test-id' );
$p->next_tag() === false;
$p->get_attribute_names_with_prefix( 'data-' ) === null; $prefixstringrequired
null when no tag opener is matched.
$this->generate_implied_end_tags_thoroughly();
if ( ! $this->state->stack_of_open_elements->current_node_is( 'TEMPLATE' ) ) {
| Version | Description |
|---|---|
| 6.6.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_html_processor/get_attribute_names_with_prefix