目前有没有办法使用 HTML5之外的标签在 WebKit 中?
我尝试在整个 HTML 文档中使用 标记来标记隐藏的微数据值,如 Mark Pilgrim 的 深入了解 HTML 5。但是,当我的页面在 Chrome(特别是 Chromium 6.0.418.0)中加载时,我收到以下错误消息:
<meta> is not allowed inside <article>. Moving <meta> into the <head>.
<meta> is not allowed inside <span>. Moving <meta> into the <head>.
<meta> is not allowed inside <div>. Moving <meta> into the <head>.
目前是否有解决方法? Firefox 3.6.13 中也发生了同样的情况,尽管我此时对 WebKit 的解决方法特别感兴趣。
I'm trying to use <meta>
tags throughout my HTML document to mark-up hidden microdata values, as descriped in Mark Pilgrim's Dive Into HTML 5. However, when my page loads in Chrome (specifically, Chromium 6.0.418.0), I get the following error messages:
<meta> is not allowed inside <article>. Moving <meta> into the <head>.
<meta> is not allowed inside <span>. Moving <meta> into the <head>.
<meta> is not allowed inside <div>. Moving <meta> into the <head>.
Is there currently a workaround for this? The same thing happens in Firefox 3.6.13, though I am particularly interested in a workaround for WebKit at this time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WebKit 的最新版本(如 Firefox)具有兼容 HTML5 的解析器,并且支持
head
元素之外的meta
元素。我还应该指出,W3Schools 与 W3C 无关,并且以发表完全无稽之谈而闻名。此外,Microdata 仍然是 HTML 的一部分,使用它是完全没问题的。它在 W3C 上以单独的草案形式发布这一事实并没有以任何方式改变这一点。
More recent versions of WebKit have, like Firefox, an HTML5-compliant parser, and support
meta
elements outside thehead
element.I should also note that W3Schools is not related to the W3C, and is well known to publish utter nonsense. Also, Microdata is still part of HTML, and using it is perfectly fine. The fact that it is published in a separate draft at the W3C does not change that in any way.
HTML Microdata 规范(2011 年 7 月 8 日的编辑草案)和 Google、Microsoft 和 Yahoo 的 schema.org
spec词汇表都允许将meta
元素放入主体作为微数据格式的语义数据的一部分。截至 2011 年 7 月,IE 9、FF 5 和 Chrome 12 不会抛出此错误; Safari 5 仍然如此。 (在 Win 7 上测试)更重要的是(恕我直言)W3C 的验证器不会抛出错误。
以下是正文中
meta
元素的有效示例:Both the HTML Microdata spec (Editor's Draft from 8 July 2011) and the schema.org
specvocabulary by Google, Microsoft, and Yahoo allowed themeta
element to be placed into the body as part of semantic data in the microdata format.As of July 2011, IE 9, FF 5, and Chrome 12 do not throw this error; Safari 5 still does. (Tested on Win 7) More importantly (IMHO) the W3C's validator does not throw an error.
Here is a valid example of the
meta
element in the body: