jenkins-bot has submitted this change and it was merged.

Change subject: Improve documentation for render methods
......................................................................


Improve documentation for render methods

The parameter types are incorrect and this leads to confusion
Use $ prefix for $link parameter to make clear it is a jQuery.Object

Change-Id: I3f98f3729cd06aedd791e7503233082c1402dc95
---
M resources/ext.popups.renderer/desktopRenderer.js
M resources/ext.popups.renderer/mobileRenderer.js
2 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
  Bmansurov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/ext.popups.renderer/desktopRenderer.js 
b/resources/ext.popups.renderer/desktopRenderer.js
index 0cb737e..45ab725 100644
--- a/resources/ext.popups.renderer/desktopRenderer.js
+++ b/resources/ext.popups.renderer/desktopRenderer.js
@@ -81,19 +81,19 @@
         * or by finding and calling the correct renderer
         *
         * @method render
-        * @param {Object} link
-        * @param {Object} event
+        * @param {jQuery.Object} $link that a hovercard should be shown for
+        * @param {jQuery.Event} event that triggered the render
         * @param {number} dwellStartTime the instant when the link is dwelled 
on
         * @param {string} linkInteractionToken random token representing the 
current interaction with the link
         */
-       mw.popups.render.render = function ( link, event, dwellStartTime, 
linkInteractionToken ) {
-               var linkHref = link.attr( 'href' );
+       mw.popups.render.render = function ( $link, event, dwellStartTime, 
linkInteractionToken ) {
+               var linkHref = $link.attr( 'href' );
 
                // This will happen when the mouse goes from the popup box back 
to the
                // anchor tag. In such a case, the timer to close the box is 
cleared.
                if (
                        mw.popups.render.currentLink &&
-                       mw.popups.render.currentLink[ 0 ] === link[ 0 ]
+                       mw.popups.render.currentLink[ 0 ] === $link[ 0 ]
                ) {
                        if ( closeTimer ) {
                                closeTimer.abort();
@@ -113,7 +113,7 @@
                        return;
                }
 
-               mw.popups.render.currentLink = link;
+               mw.popups.render.currentLink = $link;
                // Set the log data only after the current link is set, 
otherwise, functions like
                // closePopup will use the new log data when closing an old 
popup.
                logData = {
@@ -122,13 +122,13 @@
                        linkInteractionToken: linkInteractionToken
                };
 
-               link.on( 'mouseleave blur', mw.popups.render.leaveInactive );
-               link.off( 'click', logClickAction ).on( 'click', logClickAction 
);
+               $link.on( 'mouseleave blur', mw.popups.render.leaveInactive )
+                       .off( 'click', logClickAction ).on( 'click', 
logClickAction );
 
-               if ( mw.popups.render.cache[ link.attr( 'href' ) ] ) {
+               if ( mw.popups.render.cache[ $link.attr( 'href' ) ] ) {
                        openTimer = mw.popups.render.wait( 
mw.popups.render.POPUP_DELAY )
                                .done( function () {
-                                       mw.popups.render.openPopup( link, event 
);
+                                       mw.popups.render.openPopup( $link, 
event );
                                } );
                } else {
                        // Wait for timer before making API queries and showing 
hovercard
@@ -140,21 +140,21 @@
                                        // Check run the matcher method of all 
renderers to find the right one
                                        for ( key in renderers ) {
                                                if ( renderers.hasOwnProperty( 
key ) && key !== 'article' ) {
-                                                       if ( !!renderers[ key 
].matcher( link.attr( 'href' ) ) ) {
-                                                               cachePopup = 
renderers[ key ].init( link, $.extend( {}, logData ) );
+                                                       if ( !!renderers[ key 
].matcher( $link.attr( 'href' ) ) ) {
+                                                               cachePopup = 
renderers[ key ].init( $link, $.extend( {}, logData ) );
                                                        }
                                                }
                                        }
 
                                        // Use the article renderer if nothing 
else matches
                                        if ( cachePopup === undefined ) {
-                                               cachePopup = 
mw.popups.render.renderers.article.init( link, $.extend( {}, logData ) );
+                                               cachePopup = 
mw.popups.render.renderers.article.init( $link, $.extend( {}, logData ) );
                                        }
 
                                        openTimer = mw.popups.render.wait( 
mw.popups.render.POPUP_DELAY - mw.popups.render.API_DELAY );
 
                                        $.when( openTimer, cachePopup ).done( 
function () {
-                                               mw.popups.render.openPopup( 
link, event );
+                                               mw.popups.render.openPopup( 
$link, event );
                                        } );
                                } );
                }
diff --git a/resources/ext.popups.renderer/mobileRenderer.js 
b/resources/ext.popups.renderer/mobileRenderer.js
index 805d761..c7fc35c 100644
--- a/resources/ext.popups.renderer/mobileRenderer.js
+++ b/resources/ext.popups.renderer/mobileRenderer.js
@@ -9,15 +9,15 @@
         * Render a new LinkPreviewDrawer
         *
         * @method render
-        * @param {Object} link
-        * @param {Object} event
+        * @param {jQuery.Object} $link that a hovercard should be shown for
+        * @param {jQuery.Event} event that triggered the render
         */
-       mw.popups.render.render = function ( link, event ) {
+       mw.popups.render.render = function ( $link, event ) {
                var LinkPreviewDrawer = M.require( 
'ext.popups.mobilelinkpreview/LinkPreviewDrawer' );
 
                // Ignore if its meant to call a function
                // TODO: Remove this when adding reference popups
-               if ( link.attr( 'href' ) === '#' ) {
+               if ( $link.attr( 'href' ) === '#' ) {
                        return;
                }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3f98f3729cd06aedd791e7503233082c1402dc95
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to