[wp-trac] [WordPress Trac] #52990: Account for single quoted attributes when lazy loading images and iframes.

WordPress Trac noreply at wordpress.org
Wed Apr 7 00:24:58 UTC 2021


#52990: Account for single quoted attributes when lazy loading images and iframes.
---------------------------+------------------------------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Embeds         |    Version:  5.5
 Severity:  normal         |   Keywords:  needs-patch needs-unit-tests
  Focuses:  performance    |
---------------------------+------------------------------------------
 `wp_iframe_tag_add_loading_attr()` and `wp_img_tag_add_loading_attr()`
 includes a check to ensure the elements have a `src`, `width` and `height`
 attribute before adding the lazy loading attribute.

 In both functions the check only considers attributes using double quotes
 so the lazy loading tag is not added for elements using single quoted
 attributes. [https://github.com/WordPress/wordpress-
 develop/blob/895d6a691d7ccdfe80cdf999bc0c8a78d11ad55a/src/wp-
 includes/media.php#L1893-L1895 img ref], [https://github.com/WordPress
 /wordpress-develop/blob/895d6a691d7ccdfe80cdf999bc0c8a78d11ad55a/src/wp-
 includes/media.php#L2012-L2015 iframe ref].

 As WordPress does not normalize attribute tags to use double quotes,
 single quoted attribute tags ought to be considered.

 Image version 5.5, iframe version 5.7.

 Follow up to #50756, #52768.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52990>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list