示例(Reference/Source):
In HTML-documents no White Spaces between Attributes are needed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>no attribute space</title> <Meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p class="CLASS"title='TITLE'></p> </body> </html>
见第三行:
<p class="CLASS"title='TITLE'></p> ^^
现在使用这样的HTML块将doctype更改为HTML 5(<!DOCTYPE HTML>),使得experimental W3C HTML 5 conformance checker完全出错,告诉我:
Validation Output: 1 Error
Error Line 9,Column 22: No space between attributes.
06002
所以我认为HTML 5向后兼容浏览器在现实中如何处理HTML以及浏览器AFAIK处理这个问题.所以我至少有点困惑.我也有问题解释(有些不必要的)编译的HTML 5规范在这一点上是精确的,因为我所找到的(W3C再次,见http://www.w3.org/TR/html-markup/syntax.html#syntax-attributes)它并不是说这是(可能也不一定)是一个错误.
解决方法
Then,the start tag may have a number of attributes,the Syntax for which is described below. Attributes must be separated from each other by one or more space characters.
So I thought that HTML 5 is backwards compatible to how browsers deal with HTML in reality and browsers AFAIK deal with this well.