Backbone.js Memory Management, Rising DOM Node Count

前端 未结 4 1312
忘了有多久
忘了有多久 2020-12-14 09:59

Situation: I\'m working on a pretty decently complex single page Backbone app that could potentially be running for 8-12+ hours straight. Because of this, t

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 10:54

    i found another way to avoid jank

    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);
    }
    

    refer it here http://ozkatz.github.io/avoiding-common-backbonejs-pitfalls.html

提交回复
热议问题