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
--- 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;
+}