You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to be able to generate a page source that would give me a clean W3C HTML validation report without any notices.
While both formats are valid, using the trailing slash is discouraged and causes a lot of noise in the validation report.
Actual behavior
I get a lot of the described notices in the W3C HTML validation report.
If there is a reason (unknown to me) to preserve the current behavior, I would make it configurable in config.action_view to revert to the old behavior.
As far as I know, this originates from these two lines at ActionView::TagHelper:
Yes, this is something I noticed a few days ago as well. There are also a few other places where this is the case like error pages. You can utilize a regex search to find most of these cases.
rails-ujs however is deprecated, see #50535 and #50555, so I doubt this will be changed for that.
I made a PR (#51646) to solve the issue. Will look into the test results to see any unexpected implications, at least the actionview tests seemed to pass after the changes. (edit: failing tests already fixed in the PR)
Most other parts were in tests and I also found one actual place where the trailing slashes are needed (elements inside SVGs) but these seemed to be covered by the tests.
Steps to reproduce
<meta name="csrf-param" content="authenticity_token" />
Recently the W3C validator is giving a lot of the following types of "info" level notices for any markup generated by a Rails application:
Or in text format:
Expected behavior
I would expect to be able to generate a page source that would give me a clean W3C HTML validation report without any notices.
While both formats are valid, using the trailing slash is discouraged and causes a lot of noise in the validation report.
Actual behavior
I get a lot of the described notices in the W3C HTML validation report.
If there is a reason (unknown to me) to preserve the current behavior, I would make it configurable in
config.action_view
to revert to the old behavior.As far as I know, this originates from these two lines at
ActionView::TagHelper
:rails/actionview/lib/action_view/helpers/tag_helper.rb
Line 248 in 734719d
rails/actionview/lib/action_view/helpers/tag_helper.rb
Line 497 in 734719d
And in addition, there are also few matches at
rails-ujs.js
andrails-ujs.esm.js
:rails/actionview/app/assets/javascripts/rails-ujs.js
Lines 406 to 410 in 734719d
rails/actionview/app/assets/javascripts/rails-ujs.esm.js
Lines 454 to 458 in 734719d
System configuration
Rails version: pretty much any version, e.g. 7.1.3.2
Ruby version: 3.3.0
The text was updated successfully, but these errors were encountered: