Skip to content
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

Update spec generation to file revision 712 (amphtml tag 1533692711873) #1315

Merged
merged 5 commits into from Aug 23, 2018

Conversation

@westonruter
Copy link
Member

@westonruter westonruter commented Aug 3, 2018

This is a follow-up on #1312. Since there are validator spec changes another PR was needed to deal with them.

  • Update spec reader to account for spec format changes.
  • Add support for amp-embedly-card and amp-embedly-key.
  • Add minimum-nights attribute to amp-date-picker.
  • Add animate-in attribute to amp-lightbox.
  • Add submitting and verify-error to form.
  • Add more amp-fx values.
  • Verify updates to accommodate spec changes are correct.
  • Add changelog.
  • Add tests.

Fixes #1330.

@hellofromtonya hellofromtonya added this to In progress in v1.0 Aug 22, 2018
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

@westonruter I just ran the update spec generator. It performed as expected. It did add the new updates from the new specification, including allowing the amp-lightbox animation attributions to pass through the sanitizer.

As we discussed, we should also update the amphtml-update.py instructions, i.e. to point it to the Updating Allowed Tags and Attributes section. Done in d576d44.

if ( $node->hasAttribute( $attr_name ) ) {
$attr_value = strtolower( $node->getAttribute( $attr_name ) );
if ( $attr_value === (string) $rule_value ) {
return AMP_Rule_Spec::PASS;
} else {
return AMP_Rule_Spec::FAIL;
$result = AMP_Rule_Spec::FAIL;
Copy link
Contributor

@hellofromtonya hellofromtonya Aug 22, 2018

@westonruter Why are we allowing the rule iteration to continue if it fails? With this approach, it could fail on one of the values, but then pass on another. When it passes, it would return a pass and bail out, even though it failed previously. Is this what we want here?

Copy link
Member Author

@westonruter westonruter Aug 23, 2018

Good question. The reason is that the spec changed from value_casei being a scalar value to being an array. So instead of testing a single value, we now need to check if any match. You can see in the if condition immediately preceding that it will return immediately upon a match. But then if it does not match then this FAIL will end up being the return value after all of the values are matched. But if the element doesn't have the attribute at all, then the NOT_APPLICABLE value is returned.

Copy link
Contributor

@hellofromtonya hellofromtonya Aug 23, 2018

@westonruter Thank you for clarifying. That makes sense.

@@ -1099,13 +1122,13 @@ private function check_attr_spec_rule_value_casei( $node, $attr_name, $attr_spec
if ( $attr_value === (string) $rule_value ) {
return AMP_Rule_Spec::PASS;
} else {
return AMP_Rule_Spec::FAIL;
$result = AMP_Rule_Spec::FAIL;
Copy link
Contributor

@hellofromtonya hellofromtonya Aug 22, 2018

Same quest here as above.

Copy link
Member Author

@westonruter westonruter Aug 23, 2018

See above: https://github.com/Automattic/amp-wp/pull/1315/files/d576d442c081c14c84018ea398d4449ba43d333e#r212449155

Also, this change was required to get unit tests to pass, as I recall.

Copy link
Contributor

@hellofromtonya hellofromtonya Aug 23, 2018

@westonruter What you have presently looks good. Ping me when you the other TODOs ready for review.

@westonruter westonruter changed the title [WIP] Update spec generation to file revision 699 (amphtml tag 1532461037969) [WIP] Update spec generation to file revision 712 (amphtml tag 1533692711873) Aug 23, 2018
@westonruter westonruter dismissed hellofromtonya’s stale review Aug 23, 2018

Changes have been completed

@westonruter westonruter changed the title [WIP] Update spec generation to file revision 712 (amphtml tag 1533692711873) Update spec generation to file revision 712 (amphtml tag 1533692711873) Aug 23, 2018
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Great job @westonruter!

@westonruter westonruter merged commit e6077c3 into develop Aug 23, 2018
2 checks passed
@westonruter westonruter deleted the update/amp-spec-1532461037969 branch Aug 23, 2018
@westonruter westonruter moved this from In progress to Ready for review in v1.0 Aug 23, 2018
@westonruter westonruter moved this from Ready for review to Ready for QA in v1.0 Aug 23, 2018
@kienstra
Copy link
Contributor

@kienstra kienstra commented Sep 18, 2018

Moving To 'Ready For Merging'

If it's alright, I'm moving this to 'Ready For Merging,' as I don't think it needs functional testing. Feel free to move it back.

@kienstra kienstra moved this from Ready for QA to Ready for Merging in v1.0 Sep 18, 2018
@kienstra kienstra moved this from Ready for Merging to In Production in v1.0 Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v1.0
In Production
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants