[PATCH 5 of 6 V2] hgweb: add docFromHTML javascript function

Alexander Plavin alexander at plav.in
Sat Aug 17 17:29:00 CDT 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1376739340 -14400
#      Sat Aug 17 15:35:40 2013 +0400
# Node ID 4b97b9c7034ef5d561021ce6f1f34a2f89764e7c
# Parent  0258e9b301d3d93c820ea640fdc3d19874d01656
hgweb: add docFromHTML javascript function

It takes a string with HTML markup and creates DOM document from it.

diff -r 0258e9b301d3 -r 4b97b9c7034e mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Sat Aug 17 15:59:45 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Sat Aug 17 15:35:40 2013 +0400
@@ -329,6 +329,12 @@
     return xfr;
 }
 
+function docFromHTML(html) {
+    var doc = document.implementation.createHTMLDocument('');
+    doc.documentElement.innerHTML = html;
+    return doc;
+}
+
 function ajaxScrollInit(urlFormat,
                         nextHash,
                         nextHashRegex,


More information about the Mercurial-devel mailing list