Page MenuHomePhabricator

jQueryMsg should generate external links with 'external' CSS class
Open, Needs TriagePublic

Description

This is for parity with the server, and there is at least one practical use case. GuidedTour uses this class to detect what kind of link it is for analytics/EventLogging purposes.

Update

There is a bug in the current implementation as a result of the patch merged here.

Please see comment T267464#6625790

Event Timeline

Mattflaschen-WMF renamed this task from jQueryMsg should generate external links with 'external' class to jQueryMsg should generate external links with 'external' CSS class.Sep 26 2017, 6:35 AM
JTannerWMF subscribed.

The Growth-Team is not working on Guided Tour tasks at this time.

Unable to locate

jQueryMsg

in any of the GuidedTours file

Can you elaborate please? How is your comment related to this task, and what are steps to reproduce what you added as a comment?

Edit: Argh. Sorry, I should read better.

extension.json defines a dependency on mediawiki.jqueryMsg.

Change 634753 had a related patch set uploaded (by He7d3r; owner: He7d3r):
[mediawiki/core@master] Add 'external' class to links generated by jQueryMsg

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

Change 634753 merged by jenkins-bot:
[mediawiki/core@master] Add 'external' class to links generated by jQueryMsg

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

Jdlrobson subscribed.

There seems to be a bug in the code here, as it identifies the URL '/w/index.php?title=Jane_Grigson&action=history'; as an external link which has led to T267464

I see an external class ~/git/core/resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js

The issue is the line:

if ( target.search( 'new RegExp( '^(/|' + mw.config.get( 'wgUrlProtocols' ) + ')' )' ) !== -1 ) {
This will return 0 for relative URIs e.g.

'/w/index.php?title=Jane_Grigson&action=history'.search(new RegExp( '^(/|' + mw.config.get( 'wgUrlProtocols' ) + ')' ))