-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit decoding attribute to images with src starting with double quote #3586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamsilverstein Looks solid to me, just two nit-picks here in the test HTML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems Ok as temporary fix but as single quotes are a perfectly legitimate form of HTML, it would be good to follow up with something more elegant.
WordPress itself uses the quote types interchangeably and it seems to be fairly common in plugins too, especially when generating the markup from a set of variables.
wordpress-develop/src/wp-includes/pluggable.php
Line 2890 in 55d2653
"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @adamsilverstein. It looks good to me left some feedback for space and text changes.
https://github.com/WordPress/wordpress-develop/blob/trunk/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php contains all the unit tests for wp_img_tag_add_decoding_attr()
so is it better to move this new unit test there?
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Applied some of the more straightforward suggestions. @adamsilverstein would you be able to get this committed at some point today? |
Yes, will do. |
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
I agree it would be nice to have a more robust solution; this one seems ok for now - especially since the lazy attribute callback already has an identical check. |
@desrosj I'll get this committed and backported first thing tomorrow if you don't beat me to it. |
thanks @peterwilsoncc! |
Trac ticket: https://core.trac.wordpress.org/ticket/56969
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.