Fix invalid HTML in comment votes #5426
Merged
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.
References
Objectives
Notes
I've considered adding a validation using the w3c_rspec_validators gem (which is based on w3c_validators). However, using it would mean tests would need to connect to the W3C Markup Validation Service, which could cause our CI to randomly fail. For example, I'm getting "Too Many Requests" errors while testing whether all our components generate valid HTML.
In any case, here's the patch introducing a validation with w3c_rspec_validators, just in case we change our minds in the future.
Another option would be to use the html_validation gem, which doesn't connect to an external service, but requires a local installation of Tidy, meaning we'd add an extra dependency in order to run the tests. Also note that, in this case, we get both false positives and false negatives.
A possible implementation based on this gem would be: