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
1 changed files with 10 additions and 10 deletions

View File

@ -306,23 +306,23 @@
setContainedView: function(cv) {
if (this._childViews[0]) {
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.set('_containedView', cv);
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) {
var el = buffer.element();
this._childViewsMorph = buffer.dom.createMorph(el, null, null, el);