[Request] [+ ] D12597: followlines: don't put Unicode directly into the .js file (issue6559)

av6 (Anton Shestakov) phabricator at mercurial-scm.org
Mon May 2 08:49:03 UTC 2022


av6 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12597

AFFECTED FILES
  mercurial/templates/static/followlines.js

CHANGE DETAILS

diff --git a/mercurial/templates/static/followlines.js b/mercurial/templates/static/followlines.js
--- a/mercurial/templates/static/followlines.js
+++ b/mercurial/templates/static/followlines.js
@@ -50,13 +50,13 @@
         btn.classList.add('btn-followlines');
         var plusSpan = document.createElement('span');
         plusSpan.classList.add('followlines-plus');
-        plusSpan.textContent = '+';
+        plusSpan.innerHTML = '+';
         btn.appendChild(plusSpan);
         var br = document.createElement('br');
         btn.appendChild(br);
         var minusSpan = document.createElement('span');
         minusSpan.classList.add('followlines-minus');
-        minusSpan.textContent = '−';
+        minusSpan.innerHTML = '−';
         btn.appendChild(minusSpan);
         return btn;
     }



To: av6, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220502/3453bc71/attachment.html>


More information about the Mercurial-patches mailing list