[buddypress-trac] [BuddyPress Trac] #8340: Support native browser image lazy-loading

buddypress-trac noreply at wordpress.org
Fri Oct 16 06:02:07 UTC 2020


#8340: Support native browser image lazy-loading
------------------------------+---------------------
 Reporter:  r-a-y             |       Owner:  r-a-y
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  7.0.0
Component:  Core              |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |
------------------------------+---------------------
Changes (by r-a-y):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"12757" 12757]:
 {{{
 #!CommitTicketReference repository="" revision="12757"
 Add lazy loading support for images and iframes.

 In order to take advantage of native browser support for lazy loading,
 this commit adds the 'loading="lazy"' attribute to all <img> and
 <iframe> elements used throughout BuddyPress (activity content,
 private messaging content and avatar display).

 The generic function, bp_core_add_loading_lazy_attribute(), is
 introduced to help with this.

 A special case is made for WordPress post embeds. As of this commit,
 only Chromium-based browsers (77+) support iframe lazy loading if the
 iframe is visible on load. (See https://web.dev/iframe-lazy-loading
 /#iframe-specific-lazy-loading-behavior.)
 Since WordPress post embeds uses inline CSS to hide their iframe on
 initial load, we need to remove their inline CSS so lazy loading can
 be properly applied.

 Props r-a-y, imath.

 Fixes #8340.
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8340#comment:12>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list