Make WordPress Core

Ticket #64567: 64567.patch

File 64567.patch, 1.4 KB (added by sachinrajcp123, 7 weeks ago)

Uploaded a patch for this ticket.

  • src/wp-includes/html-api/class-wp-html-tag-processor.php

    diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php
    index 0000000000..0000000000 100644
    a b class WP_HTML_Tag_Processor {  
    28432843        public function get_attribute_names_with_prefix( $prefix ): ?array {
    28442844                if ( self::STATE_MATCHED_TAG !== $this->parser_state || $this->is_closing_tag ) {
    28452845                        return null;
    28462846                }
     2847
     2848                /*
     2849                 * Make sure pending class changes are represented as attribute updates
     2850                 * before reading the current attribute names.
     2851                 */
     2852                $this->class_name_updates_to_attributes_updates();
     2853
    28472854                $comparable = strtolower( $prefix );
    2848                 $matches    = array();
     2855                $matches    = array();
     2856
    28492857                foreach ( array_keys( $this->attributes ) as $attr_name ) {
    28502858                        if ( str_starts_with( $attr_name, $comparable ) ) {
    2851                                 $matches[] = $attr_name;
     2859                                $matches[ $attr_name ] = true;
     2860                        }
     2861                }
     2862
     2863                foreach ( $this->lexical_updates as $name => $update ) {
     2864                        if ( ! is_string( $name ) ) {
     2865                                continue;
     2866                        }
     2867
     2868                        if ( ! str_starts_with( $name, $comparable ) ) {
     2869                                continue;
     2870                        }
     2871
     2872                        if ( '' === $update->text ) {
     2873                                unset( $matches[ $name ] );
     2874                                continue;
    28522875                        }
     2876
     2877                        $matches[ $name ] = true;
    28532878                }
    2854                 return $matches;
     2879
     2880                return array_keys( $matches );
    28552881        }
    28562882
    28572883        /**