Page MenuHomePhabricator

[jquery.tipsy] Uses deprecated $.fn.live when using live option
Closed, ResolvedPublic

Description

Original bug title:
[jquery.tipsy] Uses deprecated $.fn.live when using live option

Minimal test case:

mw.loader.using( 'jquery.tipsy', function() {
	$( 'a' ).tipsy( {
		live: true
	} );
} );

Evidence:
https://phabricator.wikimedia.org/diffusion/MW/browse/master/resources/src/jquery.tipsy/jquery.tipsy.js;dcdca4944dec1228b6ca38955298c8a541f01378$186

var binder = options.live ? 'live' : 'bind',
	eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
	eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
this[ binder ]( eventIn, enter )[ binder ]( eventOut, leave );

Expected:
Work around according to http://api.jquery.com/live/

See T85048: jquery.tipsy: Don't use deprecated/removed 'context' and 'selector' features


Version: 1.24rc
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:29 AM
bzimport set Reference to bz67989.
bzimport added a subscriber: Unknown Object (MLST).
matmarex updated the task description. (Show Details)
matmarex set Security to None.
matmarex added a subscriber: alex-mashin.
matmarex removed a subscriber: Unknown Object (MLST).
Krinkle raised the priority of this task from Medium to High.Dec 10 2014, 1:40 PM
Krinkle added a project: Technical-Debt.

jQuery migration has been finalised as of last week. If this wasn't addressed, it most likely broken now.

Confirmed, it is. Throwing JS errors making my tools dysfunct.

this[binder] is not a function

$.fn.tipsy@https://bits.wikimedia.org/static-1.25wmf12/resources/src/jquery.tipsy/jquery.tipsy.js:189:13

Added the following snippet to my affected tools:

// https://phabricator.wikimedia.org/T69989
// http://code.jquery.com/jquery-migrate-1.2.1.js
jQuery.fn.live = function( types, data, fn ) {
	jQuery( this.context ).on( types, this.selector, data, fn );
	return this;
};

Change 181216 had a related patch set uploaded (by Bartosz Dziewoński):
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181216

Patch-For-Review

Change 181216 merged by jenkins-bot:
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181216

Change 181228 had a related patch set uploaded (by Mattflaschen):
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181228

Patch-For-Review

Change 181229 had a related patch set uploaded (by Mattflaschen):
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181229

Patch-For-Review

Change 181228 merged by Mattflaschen:
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181228

Change 181229 merged by Mattflaschen:
jquery.tipsy: Unbreak the 'live' option for now

https://gerrit.wikimedia.org/r/181229