Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the use of jQuery 1 functions deprecated in jQuery 3 #50

Open
laryn opened this issue Aug 8, 2024 · 6 comments
Open

Remove the use of jQuery 1 functions deprecated in jQuery 3 #50

laryn opened this issue Aug 8, 2024 · 6 comments
Assignees

Comments

@laryn
Copy link
Member

laryn commented Aug 8, 2024

This module uses the jquery method .load() to handle the load event. This method was deprecated, and causes Javascript to crash when used with jQuery 3, which is now the default for Backdrop.

The use of the event handler .load(function(){}) should be converted to .on('load', function(){})

@bugfolder bugfolder self-assigned this Aug 9, 2024
@bugfolder
Copy link
Collaborator

Library developer's main site: http://www.jacklmoore.com/colorbox/
Library github repo: https://github.com/jackmoore/colorbox
No updates since 2016. So, rather than updating to the latest version of the library, it looks like we should patch the existing library for jQuery 3 compatibility.

@bugfolder
Copy link
Collaborator

@laryn, I've got a site that uses Colorbox with jQuery3 and my colorbox images are still working. Can you post a code snippet that demonstrates the crash?

@bugfolder
Copy link
Collaborator

Other deprecated jQuery code found in the module library:

  • .click(
  • .focus()

@argiepiano
Copy link

I see the click() method, but the load() method used in line 1031 of the version packed with this module is actually the one that's not deprecated. jQuery 1 had two load() methods - one to load a page from an href (not deprecated) and one to listen to the load even (deprecated). See https://api.jquery.com/load/

The other instance, the call to load in line 463 is simply a call to the local function load, which is defined in line 912.

So, this is not it, unless click() causes the problem, which I doubt (using click in jQuery 3 in general prevented listeners from being created, but doesn't crash JS).

@laryn
Copy link
Member Author

laryn commented Aug 10, 2024

Yep, I may have jumped the gun here. I saw (and copied verbatim) @argiepiano's notice about the deprecation because the issue I was seeing seemed suspiciously similar and I perused the .js loosely and saw that .load( existed... My issue is different and I retract this with apology.

You can decide whether to handle any deprecated code that turned up here or not.

Again, sorry about that.

@bugfolder
Copy link
Collaborator

bugfolder commented Aug 10, 2024

Seems like the other deprecated calls should still be replaced, though (if possible to maintain B/C). I'll leave this issue open, but change the title.

@bugfolder bugfolder changed the title Remove Remove the use of jQuery load() method to handle load events Remove Remove the use of jQuery 1 functions deprecated in jQuery 3 Aug 10, 2024
@bugfolder bugfolder changed the title Remove Remove the use of jQuery 1 functions deprecated in jQuery 3 Remove the use of jQuery 1 functions deprecated in jQuery 3 Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants