Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#39886 closed defect (bug) (fixed)

Invalid jQuery Live Event in handlers.min.js file.

Reported by: MMDeveloper Owned by: adamsilverstein
Priority: normal Milestone: 4.8
Component: Upload Version: 3.6
Severity: normal Keywords: has-patch
Cc: Focuses: javascript

Description

Go to wp-includes/js/swfupload/handlers.min.js

At bottom of file you will see reference to ".live(" jquery event, which no longer exists. This jQuery event should be renamed to ".on(". This is a small change that is required.

More info:

http://api.jquery.com/live/

As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers.

Attachments (1)

39886.diff (889 bytes ) - added by adamsilverstein 9 years ago.

Download all attachments as: .zip

Change History (12)

#1 follow-up: @SergeyBiryukov
10 years ago

  • Component GeneralMedia

Hi @MMDeveloper, welcome to WordPress Trac! Thanks for the ticket.

FWIW, SWFUpload is no longer used by core, it's only included for compatibility with older plugins or themes, see comment:2:ticket:16668.

The latest fix to handlers.js was 3 years ago in [27243]. I guess we could fix the deprecated .live() method, but does it still work otherwise?

#2 @SergeyBiryukov
10 years ago

  • Component MediaUpload

#3 in reply to: ↑ 1 @MMDeveloper
10 years ago

I figured that,

The plugin I'm using uses the old library. Yes the library does work if you change the function name. I've only seen this issue once in the last few years of being a WordPress developer. Its a relatively quick fix, If I had to I guess I can manually update them when I need to but if you can do it as part of the next release that would be appreciated.

Tom

Replying to SergeyBiryukov:

Hi @MMDeveloper, welcome to WordPress Trac! Thanks for the ticket.

FWIW, SWFUpload is no longer used by core, it's only included for compatibility with older plugins or themes, see comment:2:ticket:16668.

The latest fix to handlers.js was 3 years ago in [27243]. I guess we could fix the deprecated .live() method, but does it still work otherwise?

Last edited 10 years ago by MMDeveloper (previous) (diff)

#4 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review4.8
  • Version trunk3.6

Related: #22975

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


9 years ago

#6 @joemcgill
9 years ago

If this really is unused, we should probably deprecate it rather than leaving the expectation that this is being maintained. However, I'm not opposed to fixing this if there's a patch.

#7 @MMDeveloper
9 years ago

Hi guys,

Look I've just mentioned this is the issue I found. You guys are in charge, Fix it or remove it. I've told you guys how to patch it in the comments above. But even I don't know the full impact of it across other sites. If you decided to remove this script, I would just re-add it for my one client.

#8 @adamsilverstein
9 years ago

  • Owner set to adamsilverstein
  • Status newassigned

In 39886.diff:

  • Switch deprecated jQuery .live() calls with .on() in wp-includes/js/swfupload/handlers.js

@MMDeveloper can you please confirm this patch is the change you were suggesting? Thanks.

#9 @MMDeveloper
9 years ago

Perfect, that's correct.

#10 @Presskopp
9 years ago

  • Keywords has-patch added

#11 @adamsilverstein
9 years ago

  • Resolutionfixed
  • Status assignedclosed

In 40431:

Upload: improve legacy SWFUpload event handlers for current jQuery.

Fix an issue where legacy JavaScript for SWFUpload still used jQuery's
deprecated live event which no longer works - switch to using on.
This JavaScript is still used by some plugins and themes.

Props MMDeveloper.
Fixes #39886.

Note: See TracTickets for help on using tickets.