Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12135 closed defect (bug) (wontfix)

language_attributes() generating invalid XHTML 1.1 code

Reported by: shidouhikari's profile shidouhikari Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: Validation Keywords: has-patch
Focuses: Cc:

Description

As of 2.9.1, the function <code>language_attributes()</code> is on general-template.php line 1734.

When <code>get_option('html_type')</code> is set to <code>'text/html'</code>, and <code>$doctype</code> to <code>'xhtml'</code>, both ifs are triggered, resulting in <code>lang="en-US" xml:lang="en-US"</code>, which is invalid for XHTML 1.1.

Yes, I know XHTML should be served as application/xml+xhtml, but we should be able to deliver XHTML 1.1 as text/html too, the CMS shouldn't be what blocks it.

Also, seeing the logic of the code, if doctype is 'xhtml' it uses 'xml:lang', which alone is valid for any XHTML version (as long as I know). So, maybe these ifs should be excludents, and if <code>$doctype</code> is passed as 'xhtml' Wordpress only adds its xml:lang and moves on without even testing html_type.

Attachments (1)

general-template.php.diff (995 bytes) - added by shidouhikari 15 years ago.
Adds support for XHTML 1.1 in <html> attributes

Download all attachments as: .zip

Change History (5)

#1 @sivel
15 years ago

  • Keywords language_attributes XHTML XHTML 1.1 doctype MIME removed
  • Milestone 2.9.2 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

WordPress does not claim to output XHTML 1.1 code. Our aim is for XHTML 1.0 code. Perhaps in the future we will change our target markup, but for the time being we are sticking with XHTML 1.0.

Closing as wontfix.

@shidouhikari
15 years ago

Adds support for XHTML 1.1 in <html> attributes

#2 @shidouhikari
15 years ago

  • Keywords has-patch added
  • Milestone set to 2.9.2
  • Resolution wontfix deleted
  • Status changed from closed to reopened

But it increases Wordpress standards validations and breaks nothing. Why not fix a bug?

#3 @toscho
15 years ago

  • Cc toscho added

No current screenreader supports xml:lang, that’s one of the reasons why XHTML 1.1 should never be sent as text/html.

If you really need this, just use a filter for 'language_attributes'. It’s already there for you. We don’t need to cover such exotic cases in the core.

#4 @nacin
15 years ago

  • Milestone 2.9.3 deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.