Created
April 5, 2017 21:10
-
-
Save viankakrisna/51650e7295ea3bb338a271ee3882f45e to your computer and use it in GitHub Desktop.
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
function elt(name, attributes) { | |
var node = document.createElement(name); | |
if (attributes) { | |
for (var attr in attributes) | |
if (attributes.hasOwnProperty(attr)) | |
node.setAttribute(attr, attributes[attr]); | |
} | |
for (var i = 2; i < arguments.length; i++) { | |
var child = arguments[i]; | |
if (typeof child == "string") | |
child = document.createTextNode(child); | |
node.appendChild(child); | |
} | |
return node; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment