Created
January 20, 2014 04:53
-
-
Save infacq/8515016 to your computer and use it in GitHub Desktop.
One way to avoid it, is to collect all rendered elements into one documentFragment, which is basically just a container for DOM elements, and then appending that single container to the DOM tree - triggering only a single page reflow. http://ozkatz.github.io/avoiding-common-backbonejs-pitfalls.html
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
render: function() { | |
this.$el.empty(); | |
var container = document.createDocumentFragment(); | |
// render each subview, appending to our root element | |
_.each(this._views, function(subview) { | |
container.appendChild(subview.render().el) | |
}); | |
this.$el.append(container); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment