Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// expression to the render context and return.
if (result === null || result === undefined) {
result = "";
}
buffer.push(result);
return;
}
}
} else if (inverseTemplate) {
set(this, 'template', inverseTemplate);
if (preserveContext) {
set(this, '_context', context);
} else {
set(this, '_context', result);
}
} else {
set(this, 'template', function() { return ''; });
}
return this._super(buffer);
}
});
createChildView: function(view, attrs) {
view = this._super(view, attrs);
var content = get(view, 'content');
var keyword = get(this, 'keyword');
if (keyword) {
view._keywords[keyword] = content;
}
// If {{#each}} is looping over an array of controllers,
// point each child view at their respective controller.
if (content && content.isController) {
set(view, 'controller', content);
}
return view;
},
_finishDisconnections: function() {
if (this.isDestroyed) return; // _outlets will be gone anyway
var outlets = get(this, '_outlets');
var pendingDisconnections = this._pendingDisconnections;
this._pendingDisconnections = null;
for (var outletName in pendingDisconnections) {
set(outlets, outletName, null);
}
}
});
});
addedViews.push(view);
}
} else {
emptyView = get(this, 'emptyView');
if (!emptyView) { return; }
if ('string' === typeof emptyView && isGlobalPath(emptyView)) {
emptyView = get(emptyView) || emptyView;
}
emptyView = this.createChildView(emptyView);
addedViews.push(emptyView);
set(this, 'emptyView', emptyView);
if (CoreView.detect(emptyView)) {
this._createdEmptyView = emptyView;
}
}
this.replace(start, 0, addedViews);
},
this.disableContentObservers(function() {
set(this, 'content', controller);
binding = new Binding('content', '_eachView.dataSource').oneWay();
binding.connect(controller);
});
var len = get(this, 'length');
if (len === 0) { return this; }
var guid;
this.enumerableContentWillChange(len, 0);
propertyWillChange(this, 'firstObject');
propertyWillChange(this, 'lastObject');
for (var i=0; i < len; i++) {
guid = guidFor(this[i]);
delete this[guid];
delete this[i];
}
set(this, 'length', 0);
propertyDidChange(this, 'firstObject');
propertyDidChange(this, 'lastObject');
this.enumerableContentDidChange(len, 0);
return this;
},
willUpdate(attrs) {
let itemController = this.getAttrFor(attrs, 'itemController');
if (itemController) {
let arrayController = get(this, '_arrayController');
set(arrayController, 'content', this.getAttrFor(attrs, 'content'));
}
},
render: function(buffer) {
var withValue = this.normalizedValue();
this._lastNormalizedValue = withValue;
if (!this.preserveContext && !this.controllerName) {
set(this, '_context', withValue);
}
var template = withValue ? this.mainTemplate : this.inverseTemplate;
renderView(this, buffer, template);
},
forEach(views, function(view) {
set(view, '_parentView', parentView);
if (!view.container && parentView) {
set(view, 'container', parentView.container);
}
});
},
forEach(views, function(view) {
set(view, '_parentView', parentView);
if (!view.container && parentView) {
set(view, 'container', parentView.container);
}
if (!get(view, 'templateData')) {
set(view, 'templateData', templateData);
}
});
},