I am doing a bit of refactoring on some logic and i came across this chunk of code and i am still trying to understand it
try {
$('a[@rel*=lightbox]').lightBox();
} catch (e) {}
I understand the try catch part but what is this part
('a[@rel*=lightbox]')
It is the old XPath way of saying find anchors with lightbox
in their rel
attribute. So it would match an anchor like the example below...
<a href="http://example.com/image.jpg" alt="image" rel="external me lightbox">Link</a>
It has been deprecated and removed from new versions of jQuery. To get it to work with the latest versions, just drop the @
:
$('a[rel*=lightbox]')
This is an Atrribute Contains selector using deprecated @
(XPath) syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With