From a1498925ef8548821a8223c7f3d9e3a6859675cd Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 4 Dec 2014 16:10:10 -0500 Subject: [PATCH] FIX: Errors due to `_elementCreated` called on `null` --- vendor/assets/javascripts/ember-cloaking.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vendor/assets/javascripts/ember-cloaking.js b/vendor/assets/javascripts/ember-cloaking.js index c207d930749..50eb5c67832 100644 --- a/vendor/assets/javascripts/ember-cloaking.js +++ b/vendor/assets/javascripts/ember-cloaking.js @@ -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);