Make WordPress Core


Ignore:
Timestamp:
06/30/2020 08:32:44 PM (5 years 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/tests/phpunit/tests/media.php

    r48237 r48239  
    26842684        $this->assertNotContains( ' loading="lazy"', $img );
    26852685    }
     2686
     2687    /**
     2688     * @ticket 50367
     2689     */
     2690    function test_wp_img_tag_add_loading_attr_with_single_quotes() {
     2691        $img = "<img src='example.png' alt=' width='300' height='225' />";
     2692        $img = wp_img_tag_add_loading_attr( $img, 'test' );
     2693
     2694        $this->assertNotContains( ' loading="lazy"', $img );
     2695    }
    26862696}
    26872697
Note: See TracChangeset for help on using the changeset viewer.