Mercurial > hg
comparison mercurial/templates/static/followlines.js @ 49171:2c0570a6d5ae
followlines: don't put Unicode directly into the .js file (issue6559)
Apparently some web server setups may serve this file in a different encoding
than UTF-8, and that results in visual garbage in the followlines button that
renders for every line in a file. So instead of using this Unicode character in
UTF-8 we can encode it as \u2212. Or, to be more explicit, we can use −
HTML entity, which resolves into exactly that character.
Since now we're using innerHTML property to set the minus part of the button,
let's use it to set the plus part as well (even though the plus sign was plain
ASCII). A wise man once said "A foolish consistency is the hobgob... eh,
whatever." Throw a brick at me if this makes things worse.
Differential Revision: https://phab.mercurial-scm.org/D12597
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 02 May 2022 12:10:28 +0400 |
parents | 685ad41feba0 |
children |
comparison
equal
deleted
inserted
replaced
49170:df3e9d98951b | 49171:2c0570a6d5ae |
---|---|
48 var btn = document.createElement('button'); | 48 var btn = document.createElement('button'); |
49 btn.title = btnTitleStart; | 49 btn.title = btnTitleStart; |
50 btn.classList.add('btn-followlines'); | 50 btn.classList.add('btn-followlines'); |
51 var plusSpan = document.createElement('span'); | 51 var plusSpan = document.createElement('span'); |
52 plusSpan.classList.add('followlines-plus'); | 52 plusSpan.classList.add('followlines-plus'); |
53 plusSpan.textContent = '+'; | 53 plusSpan.innerHTML = '+'; |
54 btn.appendChild(plusSpan); | 54 btn.appendChild(plusSpan); |
55 var br = document.createElement('br'); | 55 var br = document.createElement('br'); |
56 btn.appendChild(br); | 56 btn.appendChild(br); |
57 var minusSpan = document.createElement('span'); | 57 var minusSpan = document.createElement('span'); |
58 minusSpan.classList.add('followlines-minus'); | 58 minusSpan.classList.add('followlines-minus'); |
59 minusSpan.textContent = '−'; | 59 minusSpan.innerHTML = '−'; |
60 btn.appendChild(minusSpan); | 60 btn.appendChild(minusSpan); |
61 return btn; | 61 return btn; |
62 } | 62 } |
63 | 63 |
64 // extend DOM with CSS class for selection highlight and action buttons | 64 // extend DOM with CSS class for selection highlight and action buttons |