changeset 19741:2a9a21e1e1db

hgweb: add docFromHTML javascript function It takes a string with HTML markup and creates DOM document from it. The implementation is a part of code from https://developer.mozilla.org/en-US/docs/Web/API/DOMParser#DOMParser_HTML_extension_for_other_browsers
author Alexander Plavin <alexander@plav.in>
date Fri, 06 Sep 2013 13:30:57 +0400
parents 2228bd109706
children ac68009c31a4
files mercurial/templates/static/mercurial.js
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:57 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Fri Sep 06 13:30:57 2013 +0400
@@ -328,3 +328,9 @@
     onstart();
     return xfr;
 }
+
+function docFromHTML(html) {
+    var doc = document.implementation.createHTMLDocument('');
+    doc.documentElement.innerHTML = html;
+    return doc;
+}