Make WordPress Core

Ticket #64567: 64567-fix.patch.patch

File 64567-fix.patch.patch, 1.1 KB (added by sachinrajcp123, 6 months ago)
  • 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 4e4a8e1c5a..9a6b7d8f21 100644
    a b final class WP_HTML_Tag_Processor {  
    17161716         * @return string[] List of attribute names.
    17171717         */
    17181718        public function get_attribute_names_with_prefix( $prefix ) {
    1719                 return array_keys( $this->attributes );
     1719                $attribute_names = array();
     1720
     1721                // Include parsed attributes.
     1722                foreach ( $this->attributes as $name => $_value ) {
     1723                        if ( str_starts_with( $name, $prefix ) ) {
     1724                                $attribute_names[ $name ] = true;
     1725                        }
     1726                }
     1727
     1728                // Include enqueued attribute updates.
     1729                foreach ( $this->updated_attributes as $name => $value ) {
     1730                        if ( null === $value ) {
     1731                                unset( $attribute_names[ $name ] );
     1732                                continue;
     1733                        }
     1734
     1735                        if ( str_starts_with( $name, $prefix ) ) {
     1736                                $attribute_names[ $name ] = true;
     1737                        }
     1738                }
     1739
     1740                return array_keys( $attribute_names );
    17201741        }
    17211742}