swipebox
swipebox copied to clipboard
selector property removed in jQuery 3.0
The .selector property is used in a couple of places in swipebox, and it's been deprecated since around jQuery 1.7, and has now actually been removed in jQuery 3.0.
I don't think the use of .selector is really needed, and just changing the way those lines work to use the original matched elements instead of the selector would likely work equivalently.
I'm only finding it on line 33.
Can we just change:
selector = elem.selector,
with:
selector = '.swipeboxImg',
In my experience it's not even necessary to use a separate selector, it seems to me that it's just creating more jquery objects.
The better solution, in my opinion, would be to replace instances of using the selector variable and then remove the selector
definition entirely.
Example:
$( document ).on( 'click', selector, function( event ) {
can be rewritten as:
$( elem ).on( 'click', function( event ) {
Other example:
$elem = $( selector );
becomes:
$elem = $( elem );
Here is the patch I'm using to fix this on a couple of our sites. swipebox-selector-fix.patch.txt
It would probably work to just manually define a selector like you suggested, @shawnCaza, I'm just not sure it's necessary to have the concept of a separate selector when we already have the matched elements. Additionally, the class name doesn't have to be hard-coded in another place that way.
This PR is an even better fix than mine I believe: https://github.com/brutaldesign/swipebox/pull/298