1/**
2 * Convert a template string into HTML DOM nodes
3 * @param {String} str The template string
4 * @return {Node} The template HTML
5 */
6var stringToHTML = function (str) {
7 var parser = new DOMParser();
8 var doc = parser.parseFromString(str, 'text/html');
9 return doc.body;
10};
11
1function createElementFromHTML(htmlString) {
2 var div = document.createElement('div');
3 div.innerHTML = htmlString.trim();
4
5 // Change this to div.childNodes to support multiple top-level nodes
6 return div.firstChild;
7}