Lightbox gallery rel with array parameter validation
I am trying to validate a page in which I have implemented Lightbox and W3C thinks rel="lightbox['gallery']" is inval开发者_运维百科id 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.
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.
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. :(
Or a better idea - in my opinion ofc - instead of rel
use data-rel
. But also you have to modify lightbox a little bit ;-)
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.
精彩评论