From: Timo Tijhof Date: Wed, 18 May 2016 18:25:35 +0000 (+0100) Subject: mediawiki.page.patrol: Use this.href instead of $(this).attr('href') X-Git-Tag: 1.31.0-rc.0~6907^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=c0d72ec4735f093b66d3e5d9bf6feb84a6e5f07b;p=lhc%2Fweb%2Fwiklou.git 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 --- 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', {