WordPress.org

Make WordPress Core

Opened 2 weeks ago

#52990 new defect (bug)

Account for single quoted attributes when lazy loading images and iframes.

Reported by: peterwilsoncc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.5
Component: Embeds Keywords: needs-patch needs-unit-tests
Focuses: performance Cc:

Description

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. img ref, 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.

Change History (0)

Note: See TracTickets for help on using tickets.