Page MenuHomePhabricator

Wrong removal of spaces in javascript
Closed, ResolvedPublic


Author: jz53x


Resource Loader seems to wrongly remove spaces in javascript code in some cases using debug=false. With debug=true the code remains untouched, so no problem appears.

Test case. The original code is located under [1]. The code compressed by Resource Loader is located under [2]. There is the following line in the first listing:
InterwikiLinks[i].className += " FA"
after the compressing it appears to be:
InterwikiLinks[i].className += "FA" (note the dropped space)

Another case.
InterwikiLinks[i].title = "Гэта абраны артыкул на іншай мове.";
after the compressing appears to be:
InterwikiLinks[i].title = "Гэтаабраныартыкулнаіншаймове."; (all the spaces are dropped)

The original code is the valid javascript code, but looks like Resource Loader lost the quote-sign balance and started compressing string literals.


Version: unspecified
Severity: major



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:22 PM
bzimport set Reference to bz27481.

It's fixed now. I made a whitespace edit to MediaWiki:Common.js to circumvent caching; this'll take 5 minutes to propagate.

If anyone else encounters a similar issue with site/user JS, making a whitespace edit to the page and waiting 5 minutes should fix it. If it's a core MediaWiki file, please comment on this bug.