[wp-trac] [WordPress Trac] #34678: Responsive Images: Check if content images already have a sizes attribute
WordPress Trac
noreply at wordpress.org
Fri Nov 13 22:25:33 UTC 2015
#34678: Responsive Images: Check if content images already have a sizes attribute
----------------------------------------+------------------------
Reporter: jaspermdegroot | Owner: joemcgill
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.4
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+------------------------
Changes (by joemcgill):
* keywords: needs-patch => has-patch needs-unit-tests
Comment:
The patch looks good to me.
Note that `wp_image_add_srcset_and_sizes()` doesn't contain any checks for
the existence of a `srcset` attribute either. However, we do check for the
existence of a `srcset` attribute in `wp_make_content_images_responsive()`
before passing the image element off to `wp_image_add_srcset_and_sizes()`.
While it's possible that someone could pass and `<img>` element containing
a `srcset` attribute directly to this function, it seems unlikely and
adding a second check would add some unnecessary performance weight to the
`wp_make_content_images_responsive()` display filter, so I'm not in favor
of adding an additional check for `srcset` attributes here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34678#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list