-
Notifications
You must be signed in to change notification settings - Fork 384
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
Preserve whitespace when serializing the DOM as HTML #1309
Conversation
df030fb
to
95dc406
Compare
Note that to test, do not use the |
For anyone who wants, here is a build to test: amp.zip (v1.0-beta1-95dc4069-20180802T220041Z) To test, deactivate and uninstall the existing AMP plugin and then go to the plugins admin page and click Upload Plugin: Then select the Please test this on a non-production environment. |
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.
Approved
Hi @westonruter,
This looks good. Using your code example, I also saw that this PR fixed the issue of spaces being inserted between tags.
@westonruter Just to confirm in case you missed it in my post - this fixes it all for me both in your plugin and the AMP for WP one too which uses the utils folder in particular - thank you. |
@westonruter Will you please tell us how to test the same with the 7.3 version of PHP and for your information we have downloaded the beta version of 7.3 version but unable to check it Please let us know So that we can check it and update the code on our AMPforWP plugin |
@Zabi09 From what I can tell the issue is no longer present in PHP 7.3: https://3v4l.org/TS2tX This being the case we can bypass the whole logic in: I'll be updating the Travis build matrix to include PHP 7.3 once it is available: travis-ci/travis-ci#9717 |
Add workaround to prevent PHP from adding whitespace to format the serialization of HTML. This prevents bugs related to spaces being added between elements which can break layouts. For example, without this fix, the following HTML:
Which should get rendered as:
Will get serialized instead as:
And displayed as (with text selected to show whitespace insertion):
For some more background on the changes here, see https://stackoverflow.com/q/51660286/93579
Fixes #1304.