Created
November 15, 2014 17:38
Convert the string into DOM element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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