WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/30/2020 08:32:44 PM (4 months ago)
Author:
flixos90
Message:

Media: Only add loading attribute to img tags using double quotes.

Props azaozz.
Fixes #50367.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r48237 r48239  
    15891589        }
    15901590
    1591         // Add extra attributes to the image markup.
     1591        // Add the srcset and sizes attributes to the image markup.
    15921592        return preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
    15931593    }
     
    17381738
    17391739        // Images should have source and dimension attributes for the `loading` attribute to be added.
    1740         if ( false === strpos( $image, ' src=' ) || false === strpos( $image, ' width=' ) || false === strpos( $image, ' height=' ) ) {
     1740        if ( false === strpos( $image, ' src="' ) || false === strpos( $image, ' width="' ) || false === strpos( $image, ' height="' ) ) {
    17411741            return $image;
    17421742        }
Note: See TracChangeset for help on using the changeset viewer.