Normalize amp-bind syntax to non-bracketed data-amp-bind-* attributes#2974
Merged
swissspidy merged 7 commits intodevelopfrom Aug 13, 2019
Merged
Normalize amp-bind syntax to non-bracketed data-amp-bind-* attributes#2974swissspidy merged 7 commits intodevelopfrom
swissspidy merged 7 commits intodevelopfrom
Conversation
ataylorme
reviewed
Aug 8, 2019
b0a2ea7 to
267abc2
Compare
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)
Collaborator
Perhaps we could have some dedicated performance tests at some point? |
Member
Author
Yes. See #1017. |
This file contains hidden or 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
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