Defect #15191

HTML 5 validation failures

Added by Ksenia Altbregen about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Code cleanup/refactoring
Target version:2.4.0
Resolution:Fixed Affected version:

Description

Asserted fixes for HTML 5. Part 1.

html_validation_patch.diff Magnifier (2.97 KB) Ksenia Altbregen, 2013-10-24 15:02

html_validation_patch.diff Magnifier - Revised patch (2.87 KB) Ksenia Altbregen, 2013-10-25 11:38


Related issues

Related to Redmine - Defect #5475: Non conformances with W3C xhtml transitional standards Confirmed 2010-05-08

Associated revisions

Revision 12235
Added by Jean-Philippe Lang about 4 years ago

Replaced acronym with abbr tags (#15191).

Revision 12236
Added by Jean-Philippe Lang about 4 years ago

Prevents duplicate element ids (#15191).

Revision 12237
Added by Jean-Philippe Lang about 4 years ago

Replaces <option value=""></option> which is not HTML5 valid (#15191).

History

#1 Updated by Ksenia Altbregen about 4 years ago

Connected to Defect #5475.

#2 Updated by Etienne Massip about 4 years ago

  • Related to Defect #5475: Non conformances with W3C xhtml transitional standards added

#3 Updated by Etienne Massip about 4 years ago

  • Category set to Code cleanup/refactoring

Please describe your patch, I don't get the default empty option displayed as an nbsp entity part and "notified_project_ids[]" should remain 'notified_project_ids[]' with single quotes, this is not JavaScript.

#4 Updated by Ksenia Altbregen about 4 years ago

Well, I used the W3C validator.

The default empty option is really displayed as an nbsp entity, but the generated code

<option value=""></option>

is non-valid, while the
<option value="">&nbsp;</option>

is valid.

The code

check_box_tag(
  'notified_project_ids[]',
  project.id,
  @user.notified_projects_ids.include?(project.id))

did not work correctly; it did not convert notified_project_ids[] for each project to notified_project_ids_#{project.id}. The ids for all projects were identical.
I added the id parameter manually:
  :id => "notified_project_ids_#{project.id}"

Now multiple ids work correctly.

#5 Updated by Ksenia Altbregen about 4 years ago

Quotes for notified_project_ids[] are single again, sorry.

#6 Updated by Jean-Philippe Lang about 4 years ago

  • Tracker changed from Patch to Defect
  • Subject changed from HTML 5 Validation Venture to HTML 5 validation failures
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.4.0
  • Resolution set to Fixed

I fixed these issues more globally, see associated commits. Thanks for pointing this out.

#7 Updated by Ksenia Altbregen about 4 years ago

In r12236 you've set

:id => nil

Is this really acceptable? The elements now have no ids at all.

I've also noticed that these elements have identical names.
Both problems could be fixed by explicit transmission of :id and :name values.

P.S. There are several places with this problem (e.g. user[group_ids][] and membership[role_ids][] in users/views).

#8 Updated by Jean-Philippe Lang about 4 years ago

Ksenia Altbregen wrote:

In r12236 you've set [...]
Is this really acceptable? The elements now have no ids at all.

AFAIK, ids are not required. And they are not needed in this case, so I've set them to nil.

I've also noticed that these elements have identical names.

Yes, they have to have the same name to get the values as a single array parameter. Please, have a look at:
http://guides.rubyonrails.org/action_controller_overview.html#hash-and-array-parameters

Also available in: Atom PDF