Closed (fixed)
Project:
Bootstrap
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
5 Jun 2015 at 17:58 UTC
Updated:
8 Dec 2015 at 11:41 UTC
Jump to comment: Most recent
Hello. It appears that the theme generates code which does not pass the W3C validator (69 errors). The problems seem to be mostly with the DOCTYPE and the xmlns namespace declarations. I needed to modify html.tpl.php in my sub-theme in order to pass the W3C validator, to generate code as follows.
Please comment-- are these changes OK or will they break something else in the theme? I'm new to Drupal and I know we are using 7.37 but I'm not sure what the "-3.x-dev" or "-4.x-dev" part of the version means, or which one of those we are using.
Thanks.
Old Generated Code (before fixing errors):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html lang="en" dir="ltr"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">New Generated Code (no more errors):
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
Comments
Comment #1
markhalliwellThe doctype has actually already been fixed by this related issue.
As far as the XML namespaces, they are are actually ignored by browsers per the spec http://www.w3.org/TR/html5/dom.html#global-attributes:
It's widely known that W3C isn't always accurate in its reporting (as evidence by these errors as they really should be ignored or at least deprecated to info/warnings). They even say it on their page:
That being said, I don't see how removing these would affect anything negatively and should be safe to do so. These (just like the doctype) was really just an oversight from migrating the old BS2 code to BS3.
P.S., 7.x-3.x is correct as this is the current HEAD. 7.x-4.x is just for whenever Bootstrap decides to actually publish some BS4 code and then we can start development in that branch for upgrading. It's also used in this IQ to help postpone issues for a later release (categorizing).
Comment #2
markhalliwell<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">This project does not add this meta tag (see related issue for an in-depth explanation as to why), so it must be coming from some other project... perhaps https://www.drupal.org/project/html5_tools?
Re: removing the attributes
After reading http://www.phase2technology.com/blog/w3c-validation-for-drupal-7-html5-r..., I don't think the solution is to actually remove them, instead I think they should instead be converted. They're still needed for RDF.
Comment #3
markhalliwellErr... wrong title heh
Comment #4
northk commentedMark,
Thank you very much for your detailed review!
Comment #6
markhalliwell@neardark, please double check that this is similar in 8.x.
Comment #7
dakku commentedconfirmed to be correct in D8 branch. I guess this can be closed...
Here is a copy paste from:
http://cgit.drupalcode.org/bootstrap/tree/templates/system/html.html.twi...
Comment #8
dakku commentedComment #9
markhalliwell