swipebox icon indicating copy to clipboard operation
swipebox copied to clipboard

selector property removed in jQuery 3.0

Open bmcclure opened this issue 7 years ago • 3 comments

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.

bmcclure avatar Oct 24 '17 20:10 bmcclure

I'm only finding it on line 33.

Can we just change:

selector = elem.selector,

with:

selector = '.swipeboxImg',

shawnCaza avatar Jan 30 '18 22:01 shawnCaza

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.

bmcclure avatar May 02 '18 21:05 bmcclure

This PR is an even better fix than mine I believe: https://github.com/brutaldesign/swipebox/pull/298

bmcclure avatar Jun 07 '18 17:06 bmcclure