From c0d72ec4735f093b66d3e5d9bf6feb84a6e5f07b Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 18 May 2016 19:25:35 +0100 Subject: [PATCH] mediawiki.page.patrol: Use this.href instead of $(this).attr('href') 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/src/mediawiki/page/patrol.ajax.js b/resources/src/mediawiki/page/patrol.ajax.js index a63202f56d..ec68b3c935 100644 --- a/resources/src/mediawiki/page/patrol.ajax.js +++ b/resources/src/mediawiki/page/patrol.ajax.js @@ -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', { -- 2.20.1