Created
November 19, 2011 14:55
-
-
Save Raynos/1378918 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
<tbody> | |
{% for child in user.children if user.isFemale %} | |
<tr> | |
<td>{{ child }}</td> | |
</tr> | |
{% endfor %} | |
</tbody> |
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 build(user) { | |
var tbody = document.createElement("tbody"); | |
user.isFemale && user.children.forEach(loadTRFromChild); | |
function loadTRFromChild(child) { | |
var node = createTR(child); | |
tbody.appendChild(node); | |
} | |
} | |
function createTR(child) { | |
var tr = document.createElement("tr"); | |
var td = document.createElement("td"); | |
tr.appendChild(td); | |
td.textContent = child; | |
return tr; | |
} |
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
// x.html | |
<tbody></tbody> | |
// x.js | |
var tbody = frag.firstChild, user = data; | |
user.isFemale && user.children.forEach(loadTRFromChild); | |
function loadTRFromChild(child) { | |
var node = load("child", child); | |
tbody.appendChild(node); | |
} | |
// child.html | |
<tr><td></td></tr> | |
// child.js | |
var td = frag.firstChild.firstChild; | |
td.textContent = data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment