Gets lowercase names of all attributes matching a given prefix in the current tag.
Description
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;
See also
Parameters
$prefix
stringrequired- Prefix of requested attribute names.
Source
/*
* This code should be unreachable, because it implies the two replacements
* start at the same location and contain the same text.
*/
return $a->length - $b->length;
}
/**
* Return the enqueued value for a given attribute, if one exists.
*
* Enqueued updates can take different data types:
* - If an update is enqueued and is boolean, the return will be `true`
* - If an update is otherwise enqueued, the return will be the string value of that update.
* - If an attribute is enqueued to be removed, the return will be `null` to indicate that.
* - If no updates are enqueued, the return will be `false` to differentiate from "removed."
*
* @since 6.2.0
Changelog
Version | Description |
---|---|
6.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.