-
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
Normalize amp-bind syntax to non-bracketed data-amp-bind-* attributes #2974
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ataylorme
reviewed
Aug 8, 2019
westonruter
force-pushed
the
update/amp-bind-syntax
branch
from
August 9, 2019 23:42
b0a2ea7
to
267abc2
Compare
westonruter
changed the title
Eliminate restoration of bracketed amp-bind syntax after parsing
Normalize amp-bind syntax to non-bracketed data-amp-bind-* attributes
Aug 10, 2019
swissspidy
reviewed
Aug 12, 2019
…p-bind-syntax * 'develop' of github.com:ampproject/amp-wp: RTLCSS all the things (#2977) Fix AMP Story editor compatibility with code editor (#3007) Update dependency core-js to v3.2.1 (#3011) Update amphtml validator spec to v1907301630320 (#3003) Improve handling of unlisted Vimeo videos (#2986) Always hide AMP admin menu item and compatibility tool menu ite… (#3005) Update dependency dom-scroll-into-view to v2.0.1 (#3008) Hide tooltips that should be hidden (#2988)
swissspidy
approved these changes
Aug 13, 2019
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.
Nice work!
Perhaps we could have some dedicated performance tests at some point? |
Yes. See #1017. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1162.
The libxml in PHP does not understand the bracketed syntax of bound attributes in AMP-bind. So before loading an HTML document into the DOM, we first have to convert the bracketed syntax into something that is not munged via
\AMP_DOM_Utils::convert_amp_bind_attributes()
. Originally this replacement was a placeholder that was replaced with the bracketed-syntax upon serialization (via\AMP_DOM_Utils::restore_amp_bind_attributes()
).However, AMP now supports an alternative syntax for bound attributes which is XML-compatible: instead of
[foo]
one doesdata-amp-bind-foo
. Now that this is equivalent in AMP, there is no need to restore the bracketed syntax upon serialization. We can normalize to the XML-compatible syntax. A couple added benefits to this are:data-amp-bind-*
attributes.Build for testing: amp.zip - v1.2.1-beta1-20190812T202306Z-b41861fe