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

Projects
None yet
2 participants
@westonruter
Copy link
Member

westonruter commented Aug 12, 2018

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

@amedina
Copy link
Member

amedina left a comment

Small change; good impact on DX. Ship it.

@westonruter westonruter merged commit bf6804d into develop Aug 12, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the fix/validation-error-order branch Aug 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment