[wp-trac] [WordPress Trac] #50756: Lazy-load iframes

WordPress Trac noreply at wordpress.org
Fri Jul 24 16:23:38 UTC 2020


#50756: Lazy-load iframes
-------------------------+------------------------------------------
 Reporter:  flixos90     |      Owner:  flixos90
     Type:  enhancement  |     Status:  assigned
 Priority:  normal       |  Milestone:  Future Release
Component:  Media        |    Version:
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests
  Focuses:               |
-------------------------+------------------------------------------
 As part of #44427, it was considered to lazy-load iframes in addition to
 images, however at that point the `loading` attribute on `iframe` tags was
 not yet formalized as part of the living HTML standard.
 [https://github.com/whatwg/html/pull/5579 This has changed a few weeks
 ago] (see [https://html.spec.whatwg.org/multipage/iframe-embed-object.html
 #attr-iframe-loading the iframe loading attribute]), so we should consider
 adding a `loading="lazy"` attribute to iframes as well.

 Likely the biggest surface area here will be oEmbed content, which is
 probably the most common way that WordPress sites include iframes.

 We should generally try to follow a similar implementation like we did for
 images, relying on `wp_lazy_loading_enabled()` and
 `wp_filter_content_tags()`, which were intentionally built and named in a
 way that they are not limited to images only.

 Another principle that we should follow is that the attribute should only
 be added to iframes which have `width` and `height` attributes specified.

 [https://web.dev/iframe-lazy-loading/ This web.dev post provides more
 information on iframe lazy-loading.]

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


More information about the wp-trac mailing list