Make WordPress Core

Opened 15 years ago

Closed 13 years ago

#11554 closed defect (bug) (fixed)

Calendar generated by WordPress is invalid HTML5

Reported by: avcascade's profile avcascade Owned by: ryan's profile ryan
Milestone: 3.2 Priority: normal
Severity: minor Version: 2.9
Component: Validation Keywords: has-patch
Focuses: Cc:

Description

While building an HTML5 theme for WordPress (I don't use XHTML, this is why) I discovered that the calendar generated by WordPress' general-template is not valid HTML5.

Two attributes are causing problems: summary (which is obsolete) and abbr, which seems redundant since title contains the same information.

Removing the summary and abbr attributes from general-template causes a WordPress blog with an HTML5 theme to properly validate using the conformance checker. Since the summary and abbr attributes do not appear necessary for the display of the calendar, it seems like removing them would make the core leaner and meaner.

Line with summary:

echo '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">

There are several lines with abbr, like:

echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";

Attachments (4)

ValidationErrorsWPCalendar.html (12.0 KB) - added by avcascade 15 years ago.
11554.patch (2.0 KB) - added by iammattthomas 15 years ago.
Removes the summary attribute from the calendar table element. Removes the abbr attribute from the calendar th and td elements. Calendar output validates as HTML5.
11554.2.patch (635 bytes) - added by ocean90 13 years ago.
Screenshot.png (197.2 KB) - added by studionashvegas 13 years ago.
Ran a source dump of a clean install with one widget through the validator - checks clean.

Download all attachments as: .zip

Change History (18)

#1 @dd32
15 years ago

  • Keywords dev-feedback added; Calendar removed

WordPress itself does not output HTML5, instead, All functions will generally return HTML4/XHTML strings.

Theme authors may replace core strings via filters and/or registering their own widgets if WordPress's output doesnt conform to their Doctype specifications.

I'm setting this a dev-feedback, with the question of: What Doctypes does WordPress currently support, and what should it support?

Given that the attributes there at present are virtually useless to most people, i see no reason to not remove them, however, Future output may not conform to HTML5 spec either.

#2 @hakre
15 years ago

WordPress does support any doctype. It can be configured. Mainly this is HTML and XHTML but this is configure-able.

HTML5 still is a draft, it makes no sense to validate against it right now.

But in any case, the reported redundant information should be removed. I would favor for the title attribute.

#3 @hakre
15 years ago

  • Keywords needs-patch added; dev-feedback removed

Some wise words: The referenced resource - which is a must read for any webdev - suggests to stick with HTML 4.01. Why not build a theme based on that standard. I would like to see WordPress to at least validate against that standard (plus ARIA maybe).

#4 @hakre
15 years ago

  • Milestone changed from Unassigned to 3.0

@iammattthomas
15 years ago

Removes the summary attribute from the calendar table element. Removes the abbr attribute from the calendar th and td elements. Calendar output validates as HTML5.

#5 @iammattthomas
15 years ago

  • Keywords has-patch added; needs-patch removed

#6 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12943]) Make calendar valid HTML 5. Props iammattthomas. fixes #11554

#7 @anmari
13 years ago

  • Component changed from Template to Widgets
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.9 to 3.2

Line 1149 of general-template.php in 3.2 "bleeding edge" just updated is still generating invalid html

<table id="wp-calendar" summary="Calendar"

The summary attribute is obsolete. Consider describing the structure of complex tables in <caption> or in a paragraph and pointing to the paragraph using the aria-describedby attribute.

Patch not applied?

Version 0, edited 13 years ago by anmari (next)

#8 @ocean90
13 years ago

  • Component changed from Widgets to Template
  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.0 to 3.2
  • Version changed from 3.2 to 2.9

Interesting, it was reverted with r13048 by mistake.

@ocean90
13 years ago

#9 @ocean90
13 years ago

  • Keywords has-patch added; needs-patch removed

@studionashvegas
13 years ago

Ran a source dump of a clean install with one widget through the validator - checks clean.

#10 @studionashvegas
13 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed
  • Version changed from 2.9 to 3.2

Patch applied, source ran through HTML5Validator (http://html5.validator.nu/) with clean validation.

#11 @nacin
13 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version changed from 3.2 to 2.9

#12 @ramoonus
13 years ago

  • Component changed from Template to Charset

doesn`t this belong to validation?

#13 @ramoonus
13 years ago

  • Component changed from Charset to Validation

#14 @ryan
13 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from reopened to closed

In [18120]:

Remove summary attribute. Props ocean90. fixes #11554

Note: See TracTickets for help on using tickets.