带有数组参数验证的 Lightbox gallery rel
我正在尝试验证已实现 Lightbox 的页面,并且 W3C 认为 rel="lightbox['gallery']" 是无效代码。代码是:
<a rel="lightbox[gallery]" href="link-to-image">
...image...
</a>
错误:
Bad value lightbox[gallery] for attribute rel on element a: Keyword lightbox[gallery] is not registered.
欢迎对此有任何见解。
I am trying to validate a page in which I have implemented Lightbox and W3C thinks rel="lightbox['gallery']" is invalid code. Code is :
<a rel="lightbox[gallery]" href="link-to-image">
...image...
</a>
Error:
Bad value lightbox[gallery] for attribute rel on element a: Keyword lightbox[gallery] is not registered.
Any insight into this is welcomed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
至少对我来说,使用“target”而不是“rel”或“data-rel”(无论如何这都不是标准链接属性)更舒服,因此仍然可以通过 w3 HTML5 验证并且不会弄乱页面的 CSS 设置(“ class”通常用于布局等)。当然,javascript 源代码中的所有“*.getAttribute('rel')”都必须相应更新。
At least for me it's more comfortable to use "target" instead of "rel" or "data-rel" (which is not a standard link attribute anyway), thus still pass w3 HTML5 validation and do not mess with page's CSS setup ("class" is commonly used for layout and such). Of course all "*.getAttribute('rel')" in javascript source has to be updated accordingly.
您正在尝试验证 HTML5,对吗?
恐怕这很简单; HTML4 允许 rel 中的几乎任何内容,而 HTML5 则严格得多,并且“lightbox[gallery]”不是注册的 rel 类型。
我已经看到了一个应该有效的修复:让 Lightbox 查找 class="lightbox[gallery]" 而不是 rel="lightbox[gallery]",但到目前为止,我的无能调整还没有起作用。我正在尝试联系 Lightbox 开发人员询问此事,但他的论坛给出了 500 个错误。这不是一个好兆头。 :(
You're trying to validate HTML5, right?
It's simple enough I'm afraid; whereas HTML4 allows pretty much any content in rel, HTML5 is much stricter and "lightbox[gallery]" isn't a registered rel type.
I've seen a fix which should work: get Lightbox to look for class="lightbox[gallery]" instead of rel="lightbox[gallery]", but so far my inept tweaks haven't worked. I'm trying to contact the Lightbox dev to ask him about this, but his forum is giving 500 errors. Not a good sign. :(
或者更好的主意 - 在我看来 ofc - 使用
data-rel
而不是rel
。但你还必须稍微修改一下灯箱;-)Or a better idea - in my opinion ofc - instead of
rel
usedata-rel
. But also you have to modify lightbox a little bit ;-)对于 Lightbox2,您应该使用
This will validate as HTML5而不是
。
With Lightbox2, you should use
instead of
This will validate as HTML5.