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

Store validation errors in order of occurrence in document #1335

Merged
merged 1 commit into from
Aug 12, 2018

Conversation

westonruter
Copy link
Member

I'm noticing that validation errors listed on the Invalid Page screen are in reverse order from how they appear in the document. A validation error with meta viewport is at the bottom of the list, and the validation error for a custom script in the page is appearing near the top of the validation error list. Nevertheless, a CSS validation error is appearing before, so I think it is an issue with how the whitelist sanitizer is iterating over the DOM backwards. In particular, array_pop() is being used instead of array_shift() in:

https://github.com/Automattic/amp-wp/blob/8c4f8ea0b17f3f1e9faf621e4a0bfa11748a8f04/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php#L255-L273

Switching these around fixes the problem.

@westonruter westonruter added this to the v1.0 milestone Aug 12, 2018
Copy link
Member

@amedina amedina left a comment

Choose a reason for hiding this comment

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

Small change; good impact on DX. Ship it.

@westonruter westonruter merged commit bf6804d into develop Aug 12, 2018
@westonruter westonruter deleted the fix/validation-error-order branch August 12, 2018 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants