[wp-trac] [WordPress Trac] #50011: Edge case in image lazy-loading

WordPress Trac noreply at wordpress.org
Wed May 20 21:42:52 UTC 2020


#50011: Edge case in image lazy-loading
---------------------------+------------------------------
 Reporter:  superpoincare  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Media          |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by azaozz):

 Right, it is a "false positive" edge case. The code there only looks for a
 ` loading=` string in the img tag. This is the same as when adding
 `srcset`, see https://core.trac.wordpress.org/browser/tags/5.4.1/src/wp-
 includes/media.php#L1499. It is possible to somewhat enhance it by using
 regex, but there will always be a small possibility for a false positive.

 The general idea is to eliminate "false negatives" as much as possible,
 i.e. not add another `loading` attribute if one already exists. False
 positives are not great, but will not "break" anything like false
 negatives/double attributes can.

 Will test a bit to see how much slower it gets if using regex there.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50011#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list