mediawiki.jqueryMsg: Fix regression and add tests.
From If060b75f.
Thanks to jshint and us using Checkstyle reports in Jenkins
(instead of a boolean good/bad). We also see warnings that are
excluded from the regular count (but can still be useful).
https://integration.mediawiki.org/ci/job/mediawiki-core-lint/4617/checkstyleResult/NORMAL/
> Implied global 'arg'
The html escaping didn't do anything because the condition was
always false (there is no variable there by name of 'arg').
It didn't fail the tests because If060b75f didn't add any tests.
I added proper tests now for "foo [$1 bar]" where $1 is a url
containing characters ("&" specifically) that must not be double
escaped.
The test immediately failed. Addressed the bug in concat instead
of replace. append() is a very powerful jQuery method. It can
append:
* HTMLElement objects
* node lists
* jQuery objects
* Arrays with any of the above
* text strings
* html strings
"html strings" is likely decided by some kind of regex looking
for html-ish characters. Which is exactly what we don't want, we
want it to consider strings always as text, so we make a text
node instead.
And removed the useless if/else block in replace() as it was
always going for the else condition (and should). Effectively
undoing the fix from If060b75f that was supposedly fixing this
bug but didn't.
Change-Id: Ifbeae7e9bd003a33f353d42caffc3ae978c3dc56