#24499 closed enhancement (fixed)
Twenty Thirteen: Remove trailing slashes on void elements, remove type attribute from script
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | Cc: |
Description
It'd be nice if Twenty Thirteen had these small changes made since it's using an HTML5 doctype. You can find a lot of discussions on the web talking about these two things - the general consensus is that it's best practice to avoid these patterns.
Remove trailing slashes
The XHTML-style closing slashes are optional and ideally should be removed from the <meta>
and <link>
elements.
http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
Remove type attribute from script
The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".
http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#the-script-element
Current code:
<head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width" /> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> <![endif]--> <?php wp_head(); ?> </head>
Proposed:
<head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width"> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script> <![endif]--> <?php wp_head(); ?> </head>
Thanks for bringing this up.
Totally agree on the script "type" removal.
For the void element final forward slash, old habits die hard. :)
We're *still* migrating (both in practice and content) from XHTML land to HTML land, and it'll be a long time before we're there completely because of how much content is already published with the older XML-like syntax.
As you point out, all the specs (WHATWG, W3C) say that the slash is optional and has no effect on void elements. So, while not harmful, it's cruft and can be removed safely.
Some additional reading: