Created
March 14, 2013 14:03
-
-
Save bloodyowl/5161571 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
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