mediawiki.page.patrol: Use this.href instead of $(this).attr('href')
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 18 May 2016 18:25:35 +0000 (19:25 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 18 May 2016 18:25:35 +0000 (19:25 +0100)
This is the difference between prop('href') and attr('href'). The attribute
returns the (usually relative) url authored in the HTML, whereas the property
returns the effective url, which is what mw.util.getParamValue expects.

Also remove the single-use variable and needless use of jQuery
(property access is more idiomatic through, well, properties).

Change-Id: Id8589dbb24869d5a88351daa65d51ab8602f5c77

resources/src/mediawiki/page/patrol.ajax.js

index a63202f..ec68b3c 100644 (file)
@@ -14,7 +14,7 @@
        $( function () {
                var $patrolLinks = $( '.patrollink a' );
                $patrolLinks.on( 'click', function ( e ) {
-                       var $spinner, href, rcid, apiRequest;
+                       var $spinner, rcid, apiRequest;
 
                        // Start preloading the notification module (normally loaded by mw.notify())
                        mw.loader.load( 'mediawiki.notification' );
@@ -26,8 +26,7 @@
                        } );
                        $( this ).hide().after( $spinner );
 
-                       href = $( this ).attr( 'href' );
-                       rcid = mw.util.getParamValue( 'rcid', href );
+                       rcid = mw.util.getParamValue( 'rcid', this.href );
                        apiRequest = new mw.Api();
 
                        apiRequest.postWithToken( 'patrol', {