Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#39886 closed defect (bug) (fixed)

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

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

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 8 years ago.

Download all attachments as: .zip

Change History (12)

#1 follow-up: @SergeyBiryukov
8 years ago

  • Component changed from General to Media

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
8 years ago

  • Component changed from Media to Upload

#3 in reply to: ↑ 1 @MMDeveloper
8 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 8 years ago by MMDeveloper (previous) (diff)

#4 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.8
  • Version changed from trunk to 3.6

Related: #22975

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


8 years ago

#6 @joemcgill
8 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
8 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
8 years ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

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
8 years ago

Perfect, that's correct.

#10 @Presskopp
8 years ago

  • Keywords has-patch added

#11 @adamsilverstein
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

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.