Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View cruft removal. #13757

Merged
merged 7 commits into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/ember-glimmer/lib/component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CoreView from 'ember-views/views/core_view';
import ChildViewsSupport from './ember-views/child-views-support';
import ClassNamesSupport from './ember-views/class-names-support';
import ChildViewsSupport from 'ember-views/mixins/child_views_support';
import ViewStateSupport from 'ember-views/mixins/view_state_support';
import InstrumentationSupport from 'ember-views/mixins/instrumentation_support';
import AriaRoleSupport from 'ember-views/mixins/aria_role_support';
Expand Down Expand Up @@ -44,16 +44,13 @@ const Component = CoreView.extend(
isComponent: true,
layoutName: null,
layout: null,
controller: null,
_controller: null,

init() {
this._super(...arguments);
this._viewRegistry = this._viewRegistry || EmberView.views;
this[DIRTY_TAG] = new DirtyableTag();
this[ROOT_REF] = null;
this[REFS] = new EmptyObject();
this.controller = this;

// If a `defaultLayout` was specified move it to the `layout` prop.
// `layout` is no longer a CP, so this just ensures that the `defaultLayout`
Expand Down
6 changes: 5 additions & 1 deletion packages/ember-glimmer/lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class Renderer {
let dynamicScope = new DynamicScope({
view,
controller: undefined,
targetObject: undefined,
// this is generally only used for the test harness, and is not a "supported"
// mechanism for setting up a template/test environment. We are defaulting the
// targetObject to the view instance based on the assumption that it is a component
// instance
targetObject: view,
outletState: UNDEFINED_REFERENCE,
isTopLevel: true
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ moduleFor('Helpers test: {{get}}', class extends RenderingTest {

assert.strictEqual(this.$('#get-input').val(), 'banana');

this.runTask(() => set(this.context, 'context.source.banana', 'yellow'));
this.runTask(() => set(this.context, 'source.banana', 'yellow'));

assert.strictEqual(this.$('#get-input').val(), 'yellow');

Expand Down
9 changes: 0 additions & 9 deletions packages/ember-htmlbars/lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TargetActionSupport from 'ember-runtime/mixins/target_action_support';
import ActionSupport from 'ember-views/mixins/action_support';
import View from 'ember-views/views/view';

import { set } from 'ember-metal/property_set';
import { computed } from 'ember-metal/computed';

import { getOwner } from 'container/owner';
Expand Down Expand Up @@ -108,12 +107,6 @@ export let HAS_BLOCK = symbol('HAS_BLOCK');
*/
const Component = View.extend(TargetActionSupport, ActionSupport, {
isComponent: true,
/*
This is set so that the proto inspection in appendTemplatedView does not
think that it should set the component's `context` to that of the parent view.
*/
controller: null,
context: null,

instrumentName: 'component',
instrumentDisplay: computed(function() {
Expand All @@ -124,8 +117,6 @@ const Component = View.extend(TargetActionSupport, ActionSupport, {

init() {
this._super(...arguments);
set(this, 'controller', this);
set(this, 'context', this);

// If a `defaultLayout` was specified move it to the `layout` prop.
// `layout` is no longer a CP, so this just ensures that the `defaultLayout`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { assert, warn } from 'ember-metal/debug';
import buildComponentTemplate from 'ember-htmlbars/system/build-component-template';
import getCellOrValue from 'ember-htmlbars/hooks/get-cell-or-value';
import { get } from 'ember-metal/property_get';
import { set } from 'ember-metal/property_set';
import { MUTABLE_CELL } from 'ember-views/compat/attrs-proxy';
import { instrument } from 'ember-htmlbars/system/instrumentation-support';
import LegacyEmberComponent, { HAS_BLOCK } from 'ember-htmlbars/component';
Expand Down Expand Up @@ -47,14 +46,8 @@ ComponentNodeManager.create = function ComponentNodeManager_create(renderNode, e
// properties ({ id: "foo" }).
configureCreateOptions(attrs, createOptions);

// If there is a controller on the scope, pluck it off and save it on the
// component. This allows the component to target actions sent via
// `sendAction` correctly.
if (parentScope.hasLocal('controller')) {
createOptions._controller = getValue(parentScope.getLocal('controller'));
} else {
createOptions._targetObject = getValue(parentScope.getSelf());
}
// This allows the component to target actions sent via `sendAction` correctly.
createOptions._targetObject = getValue(parentScope.getSelf());

extractPositionalParams(renderNode, component, params, attrs);

Expand Down Expand Up @@ -94,7 +87,6 @@ function configureCreateOptions(attrs, createOptions) {
// they are still streams.
if (attrs.id) { createOptions.elementId = getValue(attrs.id); }
if (attrs._defaultTagName) { createOptions._defaultTagName = getValue(attrs._defaultTagName); }
if (attrs.viewName) { createOptions.viewName = getValue(attrs.viewName); }
}

ComponentNodeManager.prototype.render = function ComponentNodeManager_render(_env, visitor) {
Expand Down Expand Up @@ -183,10 +175,6 @@ export function createComponent(_component, props, renderNode, env, attrs = {})

if (props.parentView) {
props.parentView.appendChild(component);

if (props.viewName) {
set(props.parentView, props.viewName, component);
}
}

component._renderNode = renderNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import assign from 'ember-metal/assign';
import { assert, warn } from 'ember-metal/debug';
import buildComponentTemplate from 'ember-htmlbars/system/build-component-template';
import { get } from 'ember-metal/property_get';
import { set } from 'ember-metal/property_set';
import setProperties from 'ember-metal/set_properties';
import View from 'ember-views/views/view';
import { MUTABLE_CELL } from 'ember-views/compat/attrs-proxy';
Expand Down Expand Up @@ -43,7 +42,6 @@ ViewNodeManager.create = function ViewNodeManager_create(renderNode, env, attrs,
if (attrs && attrs.id) { options.elementId = getValue(attrs.id); }
if (attrs && attrs.tagName) { options.tagName = getValue(attrs.tagName); }
if (attrs && attrs._defaultTagName) { options._defaultTagName = getValue(attrs._defaultTagName); }
if (attrs && attrs.viewName) { options.viewName = getValue(attrs.viewName); }

if (found.component.create && contentScope) {
let _self = contentScope.getSelf();
Expand Down Expand Up @@ -211,10 +209,6 @@ export function createOrUpdateComponent(component, options, createOptions, rende

if (options.parentView) {
options.parentView.appendChild(component);

if (options.viewName) {
set(options.parentView, options.viewName, component);
}
}

component._renderNode = renderNode;
Expand Down
2 changes: 0 additions & 2 deletions packages/ember-runtime/lib/mixins/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export default Mixin.create(ActionHandler, ControllerContentModelAliasDeprecatio
*/
target: null,

parentController: null,

store: null,

/**
Expand Down
6 changes: 0 additions & 6 deletions packages/ember-runtime/lib/mixins/target_action_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,5 @@ function getTarget(instance) {
}
}

if (instance._controller) { return instance._controller; }

// fallback to `parentView.controller`
let parentViewController = get(instance, 'parentView.controller');
if (parentViewController) { return parentViewController; }

return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default Mixin.create({
@private
*/
this.childViews = [];
this.parentView = null;
this.ownerView = this.ownerView || this;
},

Expand Down
24 changes: 0 additions & 24 deletions packages/ember-views/lib/mixins/legacy_child_views_support.js

This file was deleted.

64 changes: 0 additions & 64 deletions packages/ember-views/lib/mixins/legacy_view_support.js

This file was deleted.

Loading