Skip to content

Instantly share code, notes, and snippets.

@bloodyowl
Created March 14, 2013 14:03
Show Gist options
  • Save bloodyowl/5161571 to your computer and use it in GitHub Desktop.
Save bloodyowl/5161571 to your computer and use it in GitHub Desktop.
Class.create({
// …
templates : {
item : $.create("article", {"class" : "item-article"})
, content : $.create("span")
}
, render : function(data){
var self = this, tmpl = self.templates
, fragment = Element.fragment()
data.foo.each(function(item){
var article = tmpl.clone()
if(item.text) article.append(tmpl.content.clone().text(item.text))
article.appendTo(fragment)
})
return fragment
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment