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.

Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same quest here as above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 August 23, 2018 21:35

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @westonruter!

@westonruter westonruter merged commit e6077c3 into develop Aug 23, 2018
@westonruter westonruter deleted the update/amp-spec-1532461037969 branch August 23, 2018 23:04
@kienstra
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants