Patchwork [1,of,3,V3] hgweb: insert followlines buttons before any children, including text nodes

login
register
mail settings
Submitter Anton Shestakov
Date April 9, 2018, 2:16 p.m.
Message ID <6d5ee23ffa66b61abf64.1523283406@neuro>
Download mbox | patch
Permalink /patch/30590/
State Accepted
Headers show

Comments

Anton Shestakov - April 9, 2018, 2:16 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1523282411 -28800
#      Mon Apr 09 22:00:11 2018 +0800
# Node ID 6d5ee23ffa66b61abf6466b87d8e813141fed364
# Parent  0a1fb171dc1ddd6a1cd1a5666e92299db12e9f5d
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.
Yuya Nishihara - April 9, 2018, 3:16 p.m.
On Mon, 09 Apr 2018 22:16:46 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1523282411 -28800
> #      Mon Apr 09 22:00:11 2018 +0800
> # Node ID 6d5ee23ffa66b61abf6466b87d8e813141fed364
> # Parent  0a1fb171dc1ddd6a1cd1a5666e92299db12e9f5d
> hgweb: insert followlines buttons before any children, including text nodes

Queued, many thanks.

Patch

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
@@ -76,7 +76,7 @@  document.addEventListener('DOMContentLoa
         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);
     }