Store validation errors in order of occurrence in document #1335
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.
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 ofarray_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.