2d9b5cb098
This patch adds two new public methods to the HTML Tag Processor: - `has_class()` indicates if a matched tag contains a given CSS class name. - `class_list()` returns a generator to iterate over all the class names in a matched tag. Included in this patch is a refactoring of the internal logic when matching a tag to reuse the new `has_class()` function. Previously it was relying on optimized code in the `matches()` function which performed byte-for-byte class name comparison. With the change in this patch it will perform class name matching on the decoded value, which might differ if a class attribute contains character references. These methods may be useful for running more complicated queries based on the presence or absence of CSS class names. The use of these methods avoids the need to manually decode the class attribute as reported by `$process->get_attribute( 'class' )`. Props dmsnell. Fixes #59209. Built from https://develop.svn.wordpress.org/trunk@56703 git-svn-id: http://core.svn.wordpress.org/trunk@56215 1a063a9b-81f0-0310-95a4-ce76da25c4cd |
||
---|---|---|
.. | ||
class-wp-html-active-formatting-elements.php | ||
class-wp-html-attribute-token.php | ||
class-wp-html-open-elements.php | ||
class-wp-html-processor-state.php | ||
class-wp-html-processor.php | ||
class-wp-html-span.php | ||
class-wp-html-tag-processor.php | ||
class-wp-html-text-replacement.php | ||
class-wp-html-token.php | ||
class-wp-html-unsupported-exception.php |