[PATCH 5 of 5] hgweb: add appendFormatHTML javascript function

Alexander Plavin alexander at plav.in
Wed Sep 18 13:33:19 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1378459858 -14400
#      Fri Sep 06 13:30:58 2013 +0400
# Node ID e8d739dbcf00190f5ee92cd18c1b015e2c2fc52f
# Parent  631f431af5acdd4c405e15b68b6360c3667ca40b
hgweb: add appendFormatHTML javascript function

This is a convenient helper function to append some formatted HTML markup to a
DOM element.

diff -r 631f431af5ac -r e8d739dbcf00 mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:58 2013 +0400
@@ -341,3 +341,7 @@
     doc.documentElement.innerHTML = html;
     return doc;
 }
+
+function appendFormatHTML(element, formatStr, replacements) {
+    element.insertAdjacentHTML('beforeend', format(formatStr, replacements));
+}


More information about the Mercurial-devel mailing list