hgweb: insert followlines buttons before any children, including text nodes
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 09 Apr 2018 22:00:11 +0800
changeset 37491 685ad41feba0
parent 37490 3a91911c4343
child 37492 8d05938dd063
hgweb: insert followlines buttons before any children, including text nodes This way the buttons come before any other content, including text nodes. Because highlight extension replaces every line of text with some <span> elements that have CSS classes for highlighting, the placement of followlines buttons used to depend on if that extension was enabled or not. Let's make the placement more consistent, it'll help the next patch in this series.
mercurial/templates/static/followlines.js
--- a/mercurial/templates/static/followlines.js	Wed Mar 28 16:28:54 2018 -0700
+++ b/mercurial/templates/static/followlines.js	Mon Apr 09 22:00:11 2018 +0800
@@ -76,7 +76,7 @@
         if ( childSupportElms.length > 0 ) {
             btnSupportElm = childSupportElms[0];
         }
-        var refNode = btnSupportElm.children[0]; // node to insert <button> before
+        var refNode = btnSupportElm.childNodes[0]; // node to insert <button> before
         btnSupportElm.insertBefore(btn, refNode);
     }