带有数组参数验证的 Lightbox gallery rel

发布于 2024-11-17 03:14:14 字数 331 浏览 2 评论 0原文

我正在尝试验证已实现 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

江南烟雨〆相思醉 2024-11-24 03:14:14

至少对我来说,使用“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.

夕色琉璃 2024-11-24 03:14:14

您正在尝试验证 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. :(

薯片软お妹 2024-11-24 03:14:14

或者更好的主意 - 在我看来 ofc - 使用 data-rel 而不是 rel。但你还必须稍微修改一下灯箱;-)

Or a better idea - in my opinion ofc - instead of rel use data-rel. But also you have to modify lightbox a little bit ;-)

奈何桥上唱咆哮 2024-11-24 03:14:14

对于 Lightbox2,您应该使用

<strong><a data-lightbox="lightbox[gallery]" href="link-to-image"></strong>

This will validate as HTML5而不是

<strong><a rel="lightbox[gallery]" href="link-to-image"></strong>

With Lightbox2, you should use

<strong><a data-lightbox="lightbox[gallery]" href="link-to-image"></strong>

instead of

<strong><a rel="lightbox[gallery]" href="link-to-image"></strong>

This will validate as HTML5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文