WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#32010 closed enhancement (invalid)

get_archives_link breaks HTML5 validation (is in XHTML)

Reported by: conraid Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1.1
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

get_archives_link in file wp_includes/general-template.php unconditionally ends link tag with '/>' which breaks page validation for HTML5 documents, like default theme and all recent themes.

It's in XHTML syntax, with /> final.

	if ('link' == $format)
		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";

You could put a condition to choose html or xhtml, or, at this point, putting the default html.

	if ('link' == $format)
		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url'>\n";

Change History (6)

#1 @deconf
5 years ago

In HTML5, for void elements, both "/>" and ">" are acceptable. The "/" is optional, see: http://www.w3.org/TR/html5/syntax.html#void-elements

#2 follow-up: @xavivars
5 years ago

If I read it properly, it actually says just the opposite:

Void elements only have a start tag; end tags must not be specified for void elements

so they CAN'T have an end tag.

#3 in reply to: ↑ 2 @dd32
5 years ago

Replying to xavivars:

If I read it properly, it actually says just the opposite:

Void elements only have a start tag; end tags must not be specified for void elements

so they CAN'T have an end tag.

This simply means they can't have an end tag - <tag /> is valid, <tag></tag> is not, check 8.1.2.1 Start tags point 6 for validation of that.

Last edited 5 years ago by dd32 (previous) (diff)

#4 @xavivars
5 years ago

@dd32: you (and @deconf) are completely right.

Sorry!

#5 @deconf
5 years ago

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

#6 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.