ember-source 4.5.0-alpha.4 → 4.5.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +13 -4
  2. package/blueprints-js/-addon-import.js +48 -0
  3. package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
  4. package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  5. package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
  6. package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  7. package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
  8. package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
  9. package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
  10. package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
  11. package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
  12. package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
  13. package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
  14. package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
  15. package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
  16. package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
  17. package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
  18. package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  19. package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  20. package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  21. package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  22. package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  23. package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
  24. package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
  25. package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
  26. package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
  27. package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
  28. package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
  29. package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
  30. package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
  31. package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
  32. package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
  33. package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
  34. package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
  35. package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
  36. package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
  37. package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
  38. package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
  39. package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
  40. package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
  41. package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
  42. package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
  43. package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
  44. package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
  45. package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
  46. package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
  47. package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
  48. package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
  49. package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
  50. package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
  51. package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
  52. package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
  53. package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
  54. package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  55. package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
  56. package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
  57. package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
  58. package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  59. package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  60. package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  61. package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  62. package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  63. package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
  64. package/blueprints-js/test-framework-detector.js +60 -0
  65. package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
  66. package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
  67. package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
  68. package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
  69. package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
  70. package/build-metadata.json +3 -3
  71. package/dist/ember-template-compiler.js +12 -5
  72. package/dist/ember-template-compiler.map +1 -1
  73. package/dist/ember-testing.js +1 -1
  74. package/dist/ember-testing.map +1 -1
  75. package/dist/ember.debug.js +722 -1001
  76. package/dist/ember.debug.map +1 -1
  77. package/dist/header/license.js +1 -1
  78. package/dist/packages/@ember/-internals/container/index.js +2 -2
  79. package/dist/packages/@ember/-internals/glimmer/index.js +33 -23
  80. package/dist/packages/@ember/-internals/metal/index.js +19 -7
  81. package/dist/packages/@ember/-internals/routing/lib/location/api.js +3 -3
  82. package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +5 -1
  83. package/dist/packages/@ember/-internals/routing/lib/services/router.js +7 -6
  84. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +9 -6
  85. package/dist/packages/@ember/-internals/routing/lib/system/route.js +6 -9
  86. package/dist/packages/@ember/-internals/routing/lib/system/router.js +4 -2
  87. package/dist/packages/@ember/-internals/routing/lib/utils.js +15 -25
  88. package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -1
  89. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +14 -15
  90. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -44
  91. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
  92. package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +7 -22
  93. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +34 -46
  94. package/dist/packages/@ember/-internals/runtime/lib/mixins/enumerable.js +2 -15
  95. package/dist/packages/@ember/-internals/runtime/lib/mixins/evented.js +13 -57
  96. package/dist/packages/@ember/-internals/runtime/lib/mixins/mutable_enumerable.js +2 -16
  97. package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +64 -134
  98. package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +28 -86
  99. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +59 -61
  100. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +17 -24
  101. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +59 -85
  102. package/dist/packages/@ember/-internals/runtime/lib/system/object.js +9 -2
  103. package/dist/packages/@ember/-internals/runtime/lib/system/object_proxy.js +3 -77
  104. package/dist/packages/@ember/-internals/utils/index.js +1 -1
  105. package/dist/packages/@ember/-internals/utils/types.js +1 -0
  106. package/dist/packages/@ember/-internals/views/lib/compat/attrs.js +1 -2
  107. package/dist/packages/@ember/-internals/views/lib/component_lookup.js +2 -2
  108. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +3 -9
  109. package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +4 -6
  110. package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +13 -18
  111. package/dist/packages/@ember/-internals/views/lib/mixins/view_state_support.js +3 -2
  112. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +57 -58
  113. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +142 -120
  114. package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -1
  115. package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -1
  116. package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +2 -2
  117. package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +3 -1
  118. package/dist/packages/@ember/application/instance.js +1 -0
  119. package/dist/packages/@ember/application/lib/application.js +8 -1
  120. package/dist/packages/@ember/canary-features/index.js +2 -2
  121. package/dist/packages/@ember/engine/instance.js +1 -1
  122. package/dist/packages/@ember/engine/lib/engine-parent.js +1 -5
  123. package/dist/packages/@ember/renderer/index.js +28 -0
  124. package/dist/packages/ember/version.js +1 -1
  125. package/docs/data.json +838 -712
  126. package/package.json +4 -3
@@ -1,81 +1,7 @@
1
1
  import FrameworkObject from './object';
2
2
  import _ProxyMixin from '../mixins/-proxy';
3
- /**
4
- `ObjectProxy` forwards all properties not defined by the proxy itself
5
- to a proxied `content` object.
6
3
 
7
- ```javascript
8
- import EmberObject from '@ember/object';
9
- import ObjectProxy from '@ember/object/proxy';
4
+ class ObjectProxy extends FrameworkObject {}
10
5
 
11
- let exampleObject = EmberObject.create({
12
- name: 'Foo'
13
- });
14
-
15
- let exampleProxy = ObjectProxy.create({
16
- content: exampleObject
17
- });
18
-
19
- // Access and change existing properties
20
- exampleProxy.get('name'); // 'Foo'
21
- exampleProxy.set('name', 'Bar');
22
- exampleObject.get('name'); // 'Bar'
23
-
24
- // Create new 'description' property on `exampleObject`
25
- exampleProxy.set('description', 'Foo is a whizboo baz');
26
- exampleObject.get('description'); // 'Foo is a whizboo baz'
27
- ```
28
-
29
- While `content` is unset, setting a property to be delegated will throw an
30
- Error.
31
-
32
- ```javascript
33
- import ObjectProxy from '@ember/object/proxy';
34
-
35
- let exampleProxy = ObjectProxy.create({
36
- content: null,
37
- flag: null
38
- });
39
- exampleProxy.set('flag', true);
40
- exampleProxy.get('flag'); // true
41
- exampleProxy.get('foo'); // undefined
42
- exampleProxy.set('foo', 'data'); // throws Error
43
- ```
44
-
45
- Delegated properties can be bound to and will change when content is updated.
46
-
47
- Computed properties on the proxy itself can depend on delegated properties.
48
-
49
- ```javascript
50
- import { computed } from '@ember/object';
51
- import ObjectProxy from '@ember/object/proxy';
52
-
53
- ProxyWithComputedProperty = ObjectProxy.extend({
54
- fullName: computed('firstName', 'lastName', function() {
55
- var firstName = this.get('firstName'),
56
- lastName = this.get('lastName');
57
- if (firstName && lastName) {
58
- return firstName + ' ' + lastName;
59
- }
60
- return firstName || lastName;
61
- })
62
- });
63
-
64
- let exampleProxy = ProxyWithComputedProperty.create();
65
-
66
- exampleProxy.get('fullName'); // undefined
67
- exampleProxy.set('content', {
68
- firstName: 'Tom', lastName: 'Dale'
69
- }); // triggers property change for fullName on proxy
70
-
71
- exampleProxy.get('fullName'); // 'Tom Dale'
72
- ```
73
-
74
- @class ObjectProxy
75
- @extends EmberObject
76
- @uses Ember.ProxyMixin
77
- @public
78
- */
79
-
80
- export default class ObjectProxy extends FrameworkObject {}
81
- ObjectProxy.PrototypeMixin.reopen(_ProxyMixin);
6
+ ObjectProxy.PrototypeMixin.reopen(_ProxyMixin);
7
+ export default ObjectProxy;
@@ -509,7 +509,7 @@ function inspectObject(obj, depth, seen) {
509
509
  let key = keys[i];
510
510
  assert('has key', key); // Looping over array
511
511
 
512
- s += `${inspectKey(key)}: ${inspectValue(obj[key], depth, seen)}`;
512
+ s += `${inspectKey(String(key))}: ${inspectValue(obj[key], depth, seen)}`;
513
513
  }
514
514
 
515
515
  s += ' }';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1 @@
1
- import { symbol } from '@ember/-internals/utils';
2
- export let MUTABLE_CELL = symbol('MUTABLE_CELL');
1
+ export const MUTABLE_CELL = Symbol('MUTABLE_CELL');
@@ -1,8 +1,8 @@
1
1
  import { Object as EmberObject } from '@ember/-internals/runtime';
2
2
  export default EmberObject.extend({
3
- componentFor(name, owner, options) {
3
+ componentFor(name, owner) {
4
4
  let fullName = `component:${name}`;
5
- return owner.factoryFor(fullName, options);
5
+ return owner.factoryFor(fullName);
6
6
  },
7
7
 
8
8
  layoutFor(name, owner, options) {
@@ -4,7 +4,7 @@
4
4
  import { inspect } from '@ember/-internals/utils';
5
5
  import { Mixin, get } from '@ember/-internals/metal';
6
6
  import { assert } from '@ember/debug';
7
- const mixinObj = {
7
+ const ActionSupport = Mixin.create({
8
8
  send(actionName, ...args) {
9
9
  assert(`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed);
10
10
  let action = this.actions && this.actions[actionName];
@@ -27,11 +27,5 @@ const mixinObj = {
27
27
  }
28
28
  }
29
29
 
30
- };
31
- /**
32
- @class ActionSupport
33
- @namespace Ember
34
- @private
35
- */
36
-
37
- export default Mixin.create(mixinObj);
30
+ });
31
+ export default ActionSupport;
@@ -1,12 +1,9 @@
1
- /**
2
- @module ember
3
- */
4
1
  import { Mixin, nativeDescDecorator } from '@ember/-internals/metal';
5
2
  import { getChildViews, addChildView } from '../system/utils';
6
- export default Mixin.create({
3
+ const ChildViewsSupport = Mixin.create({
7
4
  /**
8
5
  Array of child views. You should never edit this array directly.
9
- @property childViews
6
+ @property childViews
10
7
  @type Array
11
8
  @default []
12
9
  @private
@@ -25,4 +22,5 @@ export default Mixin.create({
25
22
  addChildView(this, view);
26
23
  }
27
24
 
28
- });
25
+ });
26
+ export default ChildViewsSupport;
@@ -4,13 +4,7 @@
4
4
  import { descriptorForProperty, Mixin } from '@ember/-internals/metal';
5
5
  import { assert } from '@ember/debug';
6
6
  const EMPTY_ARRAY = Object.freeze([]);
7
- /**
8
- @class ClassNamesSupport
9
- @namespace Ember
10
- @private
11
- */
12
-
13
- export default Mixin.create({
7
+ const ClassNamesSupport = Mixin.create({
14
8
  concatenatedProperties: ['classNames', 'classNameBindings'],
15
9
 
16
10
  init() {
@@ -24,7 +18,7 @@ export default Mixin.create({
24
18
  Standard CSS class names to apply to the view's outer element. This
25
19
  property automatically inherits any class names defined by the view's
26
20
  superclasses as well.
27
- @property classNames
21
+ @property classNames
28
22
  @type Array
29
23
  @default ['ember-view']
30
24
  @public
@@ -35,7 +29,7 @@ export default Mixin.create({
35
29
  A list of properties of the view to apply as class names. If the property
36
30
  is a string value, the value of that string will be applied as a class
37
31
  name.
38
- ```javascript
32
+ ```javascript
39
33
  // Applies the 'high' class to the view element
40
34
  import Component from '@ember/component';
41
35
  Component.extend({
@@ -43,9 +37,9 @@ export default Mixin.create({
43
37
  priority: 'high'
44
38
  });
45
39
  ```
46
- If the value of the property is a Boolean, the name of that property is
40
+ If the value of the property is a Boolean, the name of that property is
47
41
  added as a dasherized class name.
48
- ```javascript
42
+ ```javascript
49
43
  // Applies the 'is-urgent' class to the view element
50
44
  import Component from '@ember/component';
51
45
  Component.extend({
@@ -53,9 +47,9 @@ export default Mixin.create({
53
47
  isUrgent: true
54
48
  });
55
49
  ```
56
- If you would prefer to use a custom value instead of the dasherized
50
+ If you would prefer to use a custom value instead of the dasherized
57
51
  property name, you can pass a binding like this:
58
- ```javascript
52
+ ```javascript
59
53
  // Applies the 'urgent' class to the view element
60
54
  import Component from '@ember/component';
61
55
  Component.extend({
@@ -63,9 +57,9 @@ export default Mixin.create({
63
57
  isUrgent: true
64
58
  });
65
59
  ```
66
- If you would like to specify a class that should only be added when the
60
+ If you would like to specify a class that should only be added when the
67
61
  property is false, you can declare a binding like this:
68
- ```javascript
62
+ ```javascript
69
63
  // Applies the 'disabled' class to the view element
70
64
  import Component from '@ember/component';
71
65
  Component.extend({
@@ -73,11 +67,12 @@ export default Mixin.create({
73
67
  isEnabled: false
74
68
  });
75
69
  ```
76
- This list of properties is inherited from the component's superclasses as well.
77
- @property classNameBindings
70
+ This list of properties is inherited from the component's superclasses as well.
71
+ @property classNameBindings
78
72
  @type Array
79
73
  @default []
80
74
  @public
81
75
  */
82
76
  classNameBindings: EMPTY_ARRAY
83
- });
77
+ });
78
+ export default ClassNamesSupport;
@@ -2,7 +2,7 @@
2
2
  @module ember
3
3
  */
4
4
  import { Mixin } from '@ember/-internals/metal';
5
- export default Mixin.create({
5
+ const ViewStateSupport = Mixin.create({
6
6
  _transitionTo(state) {
7
7
  let priorState = this._currentState;
8
8
  let currentState = this._currentState = this._states[state];
@@ -17,4 +17,5 @@ export default Mixin.create({
17
17
  }
18
18
  }
19
19
 
20
- });
20
+ });
21
+ export default ViewStateSupport;
@@ -8,43 +8,43 @@ function K() {
8
8
  return this;
9
9
  }
10
10
 
11
- let mixin = {
11
+ const ViewMixin = Mixin.create({
12
12
  /**
13
13
  A list of properties of the view to apply as attributes. If the property
14
14
  is a string value, the value of that string will be applied as the value
15
15
  for an attribute of the property's name.
16
- The following example creates a tag like `<div priority="high" />`.
17
- ```app/components/my-component.js
16
+ The following example creates a tag like `<div priority="high" />`.
17
+ ```app/components/my-component.js
18
18
  import Component from '@ember/component';
19
- export default Component.extend({
19
+ export default Component.extend({
20
20
  attributeBindings: ['priority'],
21
21
  priority: 'high'
22
22
  });
23
23
  ```
24
- If the value of the property is a Boolean, the attribute is treated as
24
+ If the value of the property is a Boolean, the attribute is treated as
25
25
  an HTML Boolean attribute. It will be present if the property is `true`
26
26
  and omitted if the property is `false`.
27
- The following example creates markup like `<div visible />`.
28
- ```app/components/my-component.js
27
+ The following example creates markup like `<div visible />`.
28
+ ```app/components/my-component.js
29
29
  import Component from '@ember/component';
30
- export default Component.extend({
30
+ export default Component.extend({
31
31
  attributeBindings: ['visible'],
32
32
  visible: true
33
33
  });
34
34
  ```
35
- If you would prefer to use a custom value instead of the property name,
35
+ If you would prefer to use a custom value instead of the property name,
36
36
  you can create the same markup as the last example with a binding like
37
37
  this:
38
- ```app/components/my-component.js
38
+ ```app/components/my-component.js
39
39
  import Component from '@ember/component';
40
- export default Component.extend({
40
+ export default Component.extend({
41
41
  attributeBindings: ['isVisible:visible'],
42
42
  isVisible: true
43
43
  });
44
44
  ```
45
- This list of attributes is inherited from the component's superclasses,
45
+ This list of attributes is inherited from the component's superclasses,
46
46
  as well.
47
- @property attributeBindings
47
+ @property attributeBindings
48
48
  @type Array
49
49
  @default []
50
50
  @public
@@ -58,7 +58,7 @@ let mixin = {
58
58
  /**
59
59
  Return the nearest ancestor that is an instance of the provided
60
60
  class or mixin.
61
- @method nearestOfType
61
+ @method nearestOfType
62
62
  @param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),
63
63
  or an instance of Mixin.
64
64
  @return Ember.View
@@ -76,11 +76,13 @@ let mixin = {
76
76
 
77
77
  view = view.parentView;
78
78
  }
79
+
80
+ return;
79
81
  },
80
82
 
81
83
  /**
82
84
  Return the nearest ancestor that has a given property.
83
- @method nearestWithProperty
85
+ @method nearestWithProperty
84
86
  @param {String} property A property name
85
87
  @return Ember.View
86
88
  @deprecated use `yield` and contextual components for composition instead.
@@ -103,13 +105,13 @@ let mixin = {
103
105
  view is already in the DOM or not. If the view is in the DOM, the
104
106
  rendering process will be deferred to give bindings a chance
105
107
  to synchronize.
106
- If children were added during the rendering process using `appendChild`,
108
+ If children were added during the rendering process using `appendChild`,
107
109
  `rerender` will remove them, because they will be added again
108
110
  if needed by the next `render`.
109
- In general, if the display of your view changes, you should modify
111
+ In general, if the display of your view changes, you should modify
110
112
  the DOM element directly instead of manually calling `rerender`, which can
111
113
  be slow.
112
- @method rerender
114
+ @method rerender
113
115
  @public
114
116
  */
115
117
  rerender() {
@@ -122,7 +124,7 @@ let mixin = {
122
124
 
123
125
  /**
124
126
  Returns the current DOM element for the view.
125
- @property element
127
+ @property element
126
128
  @type DOMElement
127
129
  @public
128
130
  */
@@ -138,14 +140,14 @@ let mixin = {
138
140
 
139
141
  /**
140
142
  Appends the view's element to the specified parent element.
141
- Note that this method just schedules the view to be appended; the DOM
143
+ Note that this method just schedules the view to be appended; the DOM
142
144
  element will not be appended to the given element until all bindings have
143
145
  finished synchronizing.
144
- This is not typically a function that you will need to call directly when
146
+ This is not typically a function that you will need to call directly when
145
147
  building your application. If you do need to use `appendTo`, be sure that
146
148
  the target element you are providing is associated with an `Application`
147
149
  and does not have an ancestor element that is associated with an Ember view.
148
- @method appendTo
150
+ @method appendTo
149
151
  @param {String|DOMElement} A selector, element, HTML string
150
152
  @return {Ember.View} receiver
151
153
  @private
@@ -154,14 +156,15 @@ let mixin = {
154
156
  let target;
155
157
 
156
158
  if (hasDOM) {
159
+ assert(`Expected a selector or instance of Element`, typeof selector === 'string' || selector instanceof Element);
157
160
  target = typeof selector === 'string' ? document.querySelector(selector) : selector;
158
161
  assert(`You tried to append to (${selector}) but that isn't in the DOM`, target);
159
162
  assert('You cannot append to an existing Ember.View.', !matches(target, '.ember-view'));
160
163
  assert('You cannot append to an existing Ember.View.', (() => {
161
164
  let node = target.parentNode;
162
165
 
163
- while (node) {
164
- if (node.nodeType !== 9 && matches(node, '.ember-view')) {
166
+ while (node instanceof Element) {
167
+ if (matches(node, '.ember-view')) {
165
168
  return false;
166
169
  }
167
170
 
@@ -173,8 +176,10 @@ let mixin = {
173
176
  } else {
174
177
  target = selector;
175
178
  assert(`You tried to append to a selector string (${selector}) in an environment without a DOM`, typeof target !== 'string');
176
- assert(`You tried to append to a non-Element (${selector}) in an environment without a DOM`, typeof selector.appendChild === 'function');
177
- }
179
+ assert(`You tried to append to a non-Element (${selector}) in an environment without a DOM`, typeof target.appendChild === 'function');
180
+ } // SAFETY: SimpleElement is supposed to be a subset of Element so this _should_ be safe.
181
+ // However, the types are more specific in some places which necessitates the `as`.
182
+
178
183
 
179
184
  this.renderer.appendTo(this, target);
180
185
  return this;
@@ -184,13 +189,13 @@ let mixin = {
184
189
  Appends the view's element to the document body. If the view does
185
190
  not have an HTML representation yet
186
191
  the element will be generated automatically.
187
- If your application uses the `rootElement` property, you must append
192
+ If your application uses the `rootElement` property, you must append
188
193
  the view within that element. Rendering views outside of the `rootElement`
189
194
  is not supported.
190
- Note that this method just schedules the view to be appended; the DOM
195
+ Note that this method just schedules the view to be appended; the DOM
191
196
  element will not be appended to the document body until all bindings have
192
197
  finished synchronizing.
193
- @method append
198
+ @method append
194
199
  @return {Ember.View} receiver
195
200
  @private
196
201
  */
@@ -201,17 +206,17 @@ let mixin = {
201
206
  /**
202
207
  The HTML `id` of the view's element in the DOM. You can provide this
203
208
  value yourself but it must be unique (just as in HTML):
204
- ```handlebars
209
+ ```handlebars
205
210
  {{my-component elementId="a-really-cool-id"}}
206
211
  ```
207
- If not manually set a default value will be provided by the framework.
208
- Once rendered an element's `elementId` is considered immutable and you
212
+ If not manually set a default value will be provided by the framework.
213
+ Once rendered an element's `elementId` is considered immutable and you
209
214
  should never change it. If you need to compute a dynamic value for the
210
215
  `elementId`, you should do this when the component or element is being
211
216
  instantiated:
212
- ```app/components/my-component.js
217
+ ```app/components/my-component.js
213
218
  import Component from '@ember/component';
214
- export default Component.extend({
219
+ export default Component.extend({
215
220
  init() {
216
221
  this._super(...arguments);
217
222
  let index = this.get('index');
@@ -219,7 +224,7 @@ let mixin = {
219
224
  }
220
225
  });
221
226
  ```
222
- @property elementId
227
+ @property elementId
223
228
  @type String
224
229
  @public
225
230
  */
@@ -227,7 +232,7 @@ let mixin = {
227
232
 
228
233
  /**
229
234
  Called when a view is going to insert an element into the DOM.
230
- @event willInsertElement
235
+ @event willInsertElement
231
236
  @public
232
237
  */
233
238
  willInsertElement: K,
@@ -236,9 +241,9 @@ let mixin = {
236
241
  Called when the element of the view has been inserted into the DOM.
237
242
  Override this function to do any set up that requires an element
238
243
  in the document body.
239
- When a view has children, didInsertElement will be called on the
244
+ When a view has children, didInsertElement will be called on the
240
245
  child view(s) first and on itself afterwards.
241
- @event didInsertElement
246
+ @event didInsertElement
242
247
  @public
243
248
  */
244
249
  didInsertElement: K,
@@ -247,7 +252,7 @@ let mixin = {
247
252
  Called when the view is about to rerender, but before anything has
248
253
  been torn down. This is a good opportunity to tear down any manual
249
254
  observers you have installed based on the DOM state
250
- @event willClearRender
255
+ @event willClearRender
251
256
  @public
252
257
  */
253
258
  willClearRender: K,
@@ -257,7 +262,7 @@ let mixin = {
257
262
  child views). This will remove the view from any parent node, then make
258
263
  sure that the DOM element managed by the view can be released by the
259
264
  memory manager.
260
- @method destroy
265
+ @method destroy
261
266
  @private
262
267
  */
263
268
  destroy() {
@@ -270,23 +275,23 @@ let mixin = {
270
275
  Called when the element of the view is going to be destroyed. Override
271
276
  this function to do any teardown that requires an element, like removing
272
277
  event listeners.
273
- Please note: any property changes made during this event will have no
278
+ Please note: any property changes made during this event will have no
274
279
  effect on object observers.
275
- @event willDestroyElement
280
+ @event willDestroyElement
276
281
  @public
277
282
  */
278
283
  willDestroyElement: K,
279
284
 
280
285
  /**
281
286
  Called after the element of the view is destroyed.
282
- @event willDestroyElement
287
+ @event willDestroyElement
283
288
  @public
284
289
  */
285
290
  didDestroyElement: K,
286
291
 
287
292
  /**
288
293
  Called when the parentView property has changed.
289
- @event parentViewDidChange
294
+ @event parentViewDidChange
290
295
  @private
291
296
  */
292
297
  parentViewDidChange: K,
@@ -298,13 +303,13 @@ let mixin = {
298
303
  Tag name for the view's outer element. The tag name is only used when an
299
304
  element is first created. If you change the `tagName` for an element, you
300
305
  must destroy and recreate the view element.
301
- By default, the render buffer will use a `<div>` tag for views.
302
- If the tagName is `''`, the view will be tagless, with no outer element.
306
+ By default, the render buffer will use a `<div>` tag for views.
307
+ If the tagName is `''`, the view will be tagless, with no outer element.
303
308
  Component properties that depend on the presence of an outer element, such
304
309
  as `classNameBindings` and `attributeBindings`, do not work with tagless
305
310
  components. Tagless components cannot implement methods to handle events,
306
311
  and their `element` property has a `null` value.
307
- @property tagName
312
+ @property tagName
308
313
  @type String
309
314
  @default null
310
315
  @public
@@ -319,10 +324,10 @@ let mixin = {
319
324
 
320
325
  /**
321
326
  Setup a view, but do not finish waking it up.
322
- * configure `childViews`
327
+ * configure `childViews`
323
328
  * register the view with the global views hash, which is used for event
324
329
  dispatch
325
- @method init
330
+ @method init
326
331
  @private
327
332
  */
328
333
  init() {
@@ -344,7 +349,7 @@ let mixin = {
344
349
 
345
350
  /**
346
351
  Handle events from `EventDispatcher`
347
- @method handleEvent
352
+ @method handleEvent
348
353
  @param eventName {String}
349
354
  @param evt {Event}
350
355
  @private
@@ -353,11 +358,5 @@ let mixin = {
353
358
  return this._currentState.handleEvent(this, eventName, evt);
354
359
  }
355
360
 
356
- };
357
- /**
358
- @class ViewMixin
359
- @namespace Ember
360
- @private
361
- */
362
-
363
- export default Mixin.create(mixin);
361
+ });
362
+ export default ViewMixin;