Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Convert the string into DOM element
String.prototype.toDOM = function() {
var element = document.createElement("div"),
fragment = document.createDocumentFragment();
element.innerHTML=this;
fragment.appendChild(element.firstChild);
return fragment;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment