Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: jquery.tipsy: Unbreak the 'live' option for now
......................................................................

jquery.tipsy: Unbreak the 'live' option for now

It used jQuery.fn.live, which stopped existing when we removed jQuery
Migrate (c393f874). This patch basically reimplements it.

Both .context and .selector properties used here are deprecated and
will be removed in the future, so we should come up with a better
solution at some point (or intentionally disallow using this option,
rather than breaking it by accident). For now, re-added the tracking
and logging, like what jQuery Migrate provided.

https://api.jquery.com/context/
https://api.jquery.com/selector/

Bug: T69989
Change-Id: Ib1a908dc60ca23c354fb05484d9b00cf54a05ebe
---
M resources/src/jquery.tipsy/jquery.tipsy.js
1 file changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/181216/1

diff --git a/resources/src/jquery.tipsy/jquery.tipsy.js 
b/resources/src/jquery.tipsy/jquery.tipsy.js
index 58a99a5..7d8ed1b 100644
--- a/resources/src/jquery.tipsy/jquery.tipsy.js
+++ b/resources/src/jquery.tipsy/jquery.tipsy.js
@@ -6,7 +6,7 @@
 // * This installation of tipsy includes several local modifications to both 
Javascript and CSS.
 //   Please be careful when upgrading.
 
-(function($) {
+( function ( mw, $ ) {
 
     function maybeCall(thing, ctx) {
         return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
@@ -183,10 +183,19 @@
         if (!options.live) this.each(function() { get(this); });
 
         if (options.trigger != 'manual') {
-            var binder   = options.live ? 'live' : 'bind',
-                eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus',
+            var eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus',
                 eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
-            this[binder](eventIn, enter)[binder](eventOut, leave);
+            if (options.live) {
+                mw.track( 'mw.deprecate', 'tipsy-live' );
+                mw.log.warn( 'Use of the "live" option of jquery.tipsy is 
deprecated.' );
+                $( this.context )
+                    .on(eventIn, this.selector, enter)
+                    .on(eventOut, this.selector, leave);
+            } else {
+                this
+                    .on(eventIn, enter)
+                    .on(eventOut, leave);
+            }
         }
 
         return this;
@@ -256,4 +265,4 @@
         }
     };
 
-})(jQuery);
+}( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/181216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1a908dc60ca23c354fb05484d9b00cf54a05ebe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to