FIX: Errors due to _elementCreated called on null

This commit is contained in:
Robin Ward 2014-12-04 16:10:10 -05:00
parent dd7b3d313e
commit a1498925ef

View file

@ -306,23 +306,23 @@
setContainedView: function(cv) { setContainedView: function(cv) {
if (this._childViews[0]) { if (this._childViews[0]) {
this._childViews[0].destroy(); this._childViews[0].destroy();
}
this._childViews[0] = cv; this._childViews[0] = cv;
this.setupChildView(cv); }
if (!this._elementCreated || this._scheduled) return;
if (cv) {
cv.set('_parentView', this);
cv.set('templateData', this.get('templateData'));
this._childViews[0] = cv;
} else {
this._childViews.clear();
}
if (!this._elementCreated || this._scheduled) return;
this._scheduled = true; this._scheduled = true;
this.set('_containedView', cv); this.set('_containedView', cv);
Ember.run.schedule('render', this, this.updateChildView); Ember.run.schedule('render', this, this.updateChildView);
}, },
setupChildView: function (childView) {
if (childView) {
childView.set('_parentView', this);
childView.set('templateData', this.get('templateData'));
}
},
render: function (buffer) { render: function (buffer) {
var el = buffer.element(); var el = buffer.element();
this._childViewsMorph = buffer.dom.createMorph(el, null, null, el); this._childViewsMorph = buffer.dom.createMorph(el, null, null, el);