Created
October 3, 2015 13:08
-
-
Save yuheiy/c194e3838c3ca4386292 to your computer and use it in GitHub Desktop.
This file contains 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
var frag = document.createDocumentFragment(); | |
for (var i = 0, l = users.length; i < l; i++) { | |
var user = users[i]; | |
var dl = document.createElement('dl'); | |
var nameTerm = document.createElement('dt'); | |
nameTerm.textContent = 'name'; | |
dl.appendChild(nameTerm); | |
var nameDesc = document.createElement('dd'); | |
nameDesc.textContent = user.name; | |
dl.appendChild(nameDesc); | |
var ageTerm = document.createElement('dt'); | |
ageTerm.textContent = 'age'; | |
dl.appendChild(ageTerm); | |
var ageDesc = document.createElement('dd'); | |
ageDesc.textContent = user.age; | |
dl.appendChild(ageDesc); | |
frag.appendChild(dl); | |
} | |
var result = document.getElementById('result'); | |
result.appendChild(frag); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment