Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Access native a.href property instead of attribute
......................................................................

Access native a.href property instead of attribute

This is a subset of patch Ie340648. If reviewing and merging the much
larger other patch (it does much more things) is a problem, we can
merge this first, rebase the other one and have a much more focussed
discussion.

Change-Id: I4549fb1810c7dd36df8a70983d9508015c2bfadf
---
M resources/ext.popups.core.js
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/40/191040/1

diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js
index 4282f32..48fb3bc 100644
--- a/resources/ext.popups.core.js
+++ b/resources/ext.popups.core.js
@@ -137,14 +137,11 @@
         */
        mw.popups.setupTriggers = function ( $elements ) {
                $elements.on( 'mouseenter focus', function ( event ) {
-                       var
-                               $this = $( this ),
-                               href = $this.attr( 'href' );
+                       var href = this.href;
 
                        // No popup if scrolling or on certain kinds of links.
                        if (
                                mw.popups.scrolled || // Prevents hovering on 
popups while scrolling
-                               !href ||
                                href.indexOf( '?' ) !== -1 ||
                                href.indexOf( 'javascript:' ) === 0 || // 
jshint ignore:line
                                href.indexOf( location.origin + 
location.pathname + '#' ) === 0
@@ -153,7 +150,7 @@
                                return;
                        }
 
-                       mw.popups.render.render( $this, event );
+                       mw.popups.render.render( $( this ), event );
                } );
        };
 
@@ -163,7 +160,8 @@
         * @method selectPopupElements
         */
        mw.popups.selectPopupElements = function () {
-               return mw.popups.$content.find( 'a:not(' + 
mw.popups.IGNORE_CLASSES.join(', ') + ')' );
+               return mw.popups.$content
+                       .find( 'a[href]:not(' + 
mw.popups.IGNORE_CLASSES.join(', ') + ')' );
        };
 
        mw.hook( 'wikipage.content').add( function ( $content ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4549fb1810c7dd36df8a70983d9508015c2bfadf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

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

Reply via email to