Skip to content

Instantly share code, notes, and snippets.

@1Marc
Last active December 12, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1Marc/4770143 to your computer and use it in GitHub Desktop.
Save 1Marc/4770143 to your computer and use it in GitHub Desktop.
Pseudocode demonstrating pre-rendering HTML and binding views to it rather than the views generating HTML.
// Pseudocode demonstrating pre-rendering HTML
// Binding views to HTML rather than the views generating HTML
var $listItems = $('#list').find('li');
var dataset = data; // array of 1000 objects
for (var i = 0; i < dataset.length; i++) {
var view = new ItemView({model: dataset[i]});
view.setElement($listItems.eq(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment