Skip to content

Commit

Permalink
Merge pull request #220 from BigData89/master
Browse files Browse the repository at this point in the history
Added compatibility with browsers that do not support full functional…
  • Loading branch information
5HT committed Jul 16, 2015
2 parents 2c78ff9 + f01c6cc commit cdd4255
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions priv/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ function template(html, data) { // template("{this.name}",{name:"Maxim"})
return new Function(code.replace(/[\r\t\n]/g, '')).apply(data); }

function xml(html) { return new DOMParser().parseFromString(html, "application/xhtml+xml").firstChild; }

function dom(html) {
var dom = new DOMParser().parseFromString(html, "text/html")
.firstChild.getElementsByTagName("body")[0].firstChild; return dom; }
try {
var dom = new DOMParser().parseFromString(html, "text/html")
.firstChild.getElementsByTagName("body")[0].firstChild;
return dom; } catch (ex) {
var tempContainer = document.createElement("DIV");
tempContainer.innerHTML = html;
var dom = tempContainer.firstChild;
return dom; }
}

0 comments on commit cdd4255

Please sign in to comment.