dist/ember.js in ember-source-2.12.0.beta.1 vs dist/ember.js in ember-source-2.12.0.beta.2
- old
+ new
@@ -4,14 +4,15 @@
* @copyright Copyright 2011-2017 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.12.0-beta.1
+ * @version 2.12.0-beta.2
*/
var enifed, requireModule, Ember;
+var mainContext = this; // Used in ember-environment/lib/global.js
(function() {
var isNode = typeof window === 'undefined' &&
typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
@@ -1321,11 +1322,11 @@
@return {any}
*/
lookupFactory: function (fullName, options) {
_emberMetal.assert('fullName must be a proper full name', this.registry.validateFullName(fullName));
- _emberMetal.deprecate('Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.', !true, { id: 'container-lookupFactory', until: '2.13.0', url: 'TODO' });
+ _emberMetal.deprecate('Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.', !true, { id: 'container-lookupFactory', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_migrating-from-_lookupfactory-to-factoryfor' });
return deprecatedFactoryFor(this, this.registry.normalize(fullName), options);
}
}, _Container$prototype[LOOKUP_FACTORY] = function (fullName, options) {
@@ -8956,11 +8957,11 @@
For example, if you desire an action to be sent when the input is blurred,
you only need to setup the action name to the event name property.
```handlebars
- {{textarea focus-in="alertMessage"}}
+ {{textarea focus-out="alertMessage"}}
```
See more about [Text Support Actions](/api/classes/Ember.TextArea.html)
### Extension
@@ -10389,13 +10390,15 @@
function ClosureComponentReference(args, symbolTable, env) {
babelHelpers.classCallCheck(this, ClosureComponentReference);
_CachedReference.call(this);
- this.defRef = args.positional.at(0);
+
+ var firstArg = args.positional.at(0);
+ this.defRef = firstArg;
+ this.tag = firstArg.tag;
this.env = env;
- this.tag = args.positional.at(0).tag;
this.symbolTable = symbolTable;
this.args = args;
this.lastDefinition = undefined;
this.lastName = undefined;
}
@@ -10917,10 +10920,11 @@
@method hash
@for Ember.Templates.helpers
@param {Object} options
@return {Object} Hash
+ @since 2.3.0
@public
*/
"use strict";
@@ -11499,29 +11503,25 @@
return _emberGlimmerUtilsReferences.UnboundReference.create(args.positional.at(0).value());
};
});
enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember-glimmer/templates/root', 'ember-glimmer/syntax', 'ember-glimmer/template', 'ember-glimmer/components/checkbox', 'ember-glimmer/components/text_field', 'ember-glimmer/components/text_area', 'ember-glimmer/components/link-to', 'ember-glimmer/component', 'ember-glimmer/helper', 'ember-glimmer/environment', 'ember-glimmer/make-bound-helper', 'ember-glimmer/utils/string', 'ember-glimmer/renderer', 'ember-glimmer/template_registry', 'ember-glimmer/setup-registry', 'ember-glimmer/dom'], function (exports, _emberGlimmerHelpersAction, _emberGlimmerTemplatesRoot, _emberGlimmerSyntax, _emberGlimmerTemplate, _emberGlimmerComponentsCheckbox, _emberGlimmerComponentsText_field, _emberGlimmerComponentsText_area, _emberGlimmerComponentsLinkTo, _emberGlimmerComponent, _emberGlimmerHelper, _emberGlimmerEnvironment, _emberGlimmerMakeBoundHelper, _emberGlimmerUtilsString, _emberGlimmerRenderer, _emberGlimmerTemplate_registry, _emberGlimmerSetupRegistry, _emberGlimmerDom) {
/**
- [Glimmer](https://github.com/tildeio/glimmer) is a [Handlebars](http://handlebarsjs.com/)
- compatible templating engine used by Ember.js.
- Any valid Handlebars syntax is valid in an Ember template.
+ [Glimmer](https://github.com/tildeio/glimmer) is a templating engine used by Ember.js that is compatible with a subset of the [Handlebars](http://handlebarsjs.com/) syntax.
### Showing a property
Templates manage the flow of an application's UI, and display state (through
the DOM) to a user. For example, given a component with the property "name",
that component's template can use the name in several ways:
- ```javascript
- // app/components/person.js
+ ```app/components/person.js
export default Ember.Component.extend({
name: 'Jill'
});
```
- ```handlebars
- {{! app/components/person.hbs }}
+ ```app/components/person.hbs
{{name}}
<div>{{name}}</div>
<span data-name={{name}}></span>
```
@@ -11825,39 +11825,19 @@
registeredActions: _emberViews.ActionManager.registeredActions,
registerAction: function (actionState) {
var actionId = actionState.actionId;
- var actions = _emberViews.ActionManager.registeredActions[actionId];
+ _emberViews.ActionManager.registeredActions[actionId] = actionState;
- if (!actions) {
- actions = _emberViews.ActionManager.registeredActions[actionId] = [];
- }
-
- actions.push(actionState);
-
return actionId;
},
unregisterAction: function (actionState) {
var actionId = actionState.actionId;
- var actions = _emberViews.ActionManager.registeredActions[actionId];
-
- if (!actions) {
- return;
- }
-
- var index = actions.indexOf(actionState);
-
- if (index !== -1) {
- actions.splice(index, 1);
- }
-
- if (actions.length === 0) {
- delete _emberViews.ActionManager.registeredActions[actionId];
- }
+ delete _emberViews.ActionManager.registeredActions[actionId];
}
};
exports.ActionHelper = ActionHelper;
@@ -12025,15 +12005,12 @@
var actionNameRef = positional.at(1);
if (!actionNameRef[_emberGlimmerHelpersAction.INVOKE]) {
actionState.actionName = actionNameRef.value();
}
- actionState.eventName = actionState.getEventName();
- // Not sure if this is needed? If we mutate the actionState is that good enough?
- ActionHelper.unregisterAction(actionState);
- ActionHelper.registerAction(actionState);
+ actionState.eventName = actionState.getEventName();
};
ActionModifierManager.prototype.getDestructor = function getDestructor(modifier) {
return modifier;
};
@@ -12937,11 +12914,13 @@
if (args.named.has('class')) {
bucket.classRef = args.named.get('class');
}
- processComponentInitializationAssertions(component, props);
+ _emberMetal.runInDebug(function () {
+ processComponentInitializationAssertions(component, props);
+ });
if (environment.isInteractive && component.tagName !== '') {
component.trigger('willRender');
}
@@ -13150,11 +13129,13 @@
if (environment.isInteractive) {
component.trigger('willInsertElement');
}
}
- processComponentInitializationAssertions(component, {});
+ _emberMetal.runInDebug(function () {
+ processComponentInitializationAssertions(component, {});
+ });
return new ComponentStateBucket(environment, component, args, finalizer);
};
return TopComponentManager;
@@ -21036,11 +21017,14 @@
// `.extend.`
const Comment = Ember.Object.extend(EditableMixin, {
post: null
});
- let comment = Comment.create(post: somePost);
+ let comment = Comment.create({
+ post: somePost
+ });
+
comment.edit(); // outputs 'starting to edit'
```
Note that Mixins are created with `Ember.Mixin.create`, not
`Ember.Mixin.extend`.
@@ -36610,11 +36594,11 @@
init() {
alert(`Name is ${this.get('name')}`);
}
});
let steve = Person.create({
- name: "Steve"
+ name: 'Steve'
});
// alerts 'Name is Steve'.
```
NOTE: If you do override `init` for a framework class like `Ember.View`,
be sure to call `this._super(...arguments)` in your
@@ -36928,20 +36912,20 @@
mergedProperties: ['mergedProperty'],
someNonMergedProperty: {
nonMerged: 'superclass value of nonMerged'
},
mergedProperty: {
- page: {replace: false},
- limit: {replace: true}
+ page: { replace: false },
+ limit: { replace: true }
}
});
const FooBar = Bar.extend({
someNonMergedProperty: {
completelyNonMerged: 'subclass value of nonMerged'
},
mergedProperty: {
- limit: {replace: false}
+ limit: { replace: false }
}
});
let fooBar = FooBar.create();
fooBar.get('someNonMergedProperty');
// => { completelyNonMerged: 'subclass value of nonMerged' }
@@ -37081,13 +37065,13 @@
march(numberOfHours) {
alert(`${this.get('name')} marches for ${numberOfHours} hours.`);
}
});
let yehuda = Soldier.create({
- name: "Yehuda Katz"
+ name: 'Yehuda Katz'
});
- yehuda.say("Yes"); // alerts "Yehuda Katz says: Yes, sir!"
+ yehuda.say('Yes'); // alerts "Yehuda Katz says: Yes, sir!"
```
The `create()` on line #17 creates an *instance* of the `Soldier` class.
The `extend()` on line #8 creates a *subclass* of `Person`. Any instance
of the `Person` class will *not* have the `march()` method.
You can also pass `Mixin` classes to add additional properties to the subclass.
@@ -37155,17 +37139,17 @@
name: 'an object'
});
o = MyObject.create();
o.get('name'); // 'an object'
MyObject.reopen({
- say(msg){
+ say(msg) {
console.log(msg);
}
- })
+ });
o2 = MyObject.create();
- o2.say("hello"); // logs "hello"
- o.say("goodbye"); // logs "goodbye"
+ o2.say('hello'); // logs "hello"
+ o.say('goodbye'); // logs "goodbye"
```
To add functions and properties to the constructor itself,
see `reopenClass`
@method reopen
@public
@@ -37185,27 +37169,26 @@
```
In other words, this creates static properties and functions for the class.
These are only available on the class and not on any instance of that class.
```javascript
const Person = Ember.Object.extend({
- name: "",
+ name: '',
sayHello() {
- alert("Hello. My name is " + this.get('name'));
+ alert(`Hello. My name is ${this.get('name')}`);
}
});
Person.reopenClass({
- species: "Homo sapiens",
- createPerson(newPersonsName){
- return Person.create({
- name:newPersonsName
- });
+ species: 'Homo sapiens',
+
+ createPerson(name) {
+ return Person.create({ name });
}
});
let tom = Person.create({
- name: "Tom Dale"
+ name: 'Tom Dale'
});
- let yehuda = Person.createPerson("Yehuda Katz");
+ let yehuda = Person.createPerson('Yehuda Katz');
tom.sayHello(); // "Hello. My name is Tom Dale"
yehuda.sayHello(); // "Hello. My name is Yehuda Katz"
alert(Person.species); // "Homo sapiens"
```
Note that `species` and `createPerson` are *not* valid on the `tom` and `yehuda`
@@ -37948,11 +37931,11 @@
```
@class ObjectProxy
@namespace Ember
@extends Ember.Object
- @extends Ember._ProxyMixin
+ @uses Ember.ProxyMixin
@public
*/
exports.default = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsProxy.default);
});
@@ -41655,10 +41638,47 @@
@class ViewMixin
@namespace Ember
@private
*/
exports.default = _emberMetal.Mixin.create((_Mixin$create = {
+ /**
+ A list of properties of the view to apply as attributes. If the property
+ is a string value, the value of that string will be applied as the value
+ for an attribute of the property's name.
+ The following example creates a tag like `<div priority="high" />`.
+ ```javascript
+ Ember.Component.extend({
+ attributeBindings: ['priority'],
+ priority: 'high'
+ });
+ ```
+ If the value of the property is a Boolean, the attribute is treated as
+ an HTML Boolean attribute. It will be present if the property is `true`
+ and omitted if the property is `false`.
+ The following example creates markup like `<div visible />`.
+ ```javascript
+ Ember.Component.extend({
+ attributeBindings: ['visible'],
+ visible: true
+ });
+ ```
+ If you would prefer to use a custom value instead of the property name,
+ you can create the same markup as the last example with a binding like
+ this:
+ ```javascript
+ Ember.Component.extend({
+ attributeBindings: ['isVisible:visible'],
+ isVisible: true
+ });
+ ```
+ This list of attributes is inherited from the component's superclasses,
+ as well.
+ @property attributeBindings
+ @type Array
+ @default []
+ @public
+ */
concatenatedProperties: ['attributeBindings']
}, _Mixin$create[_emberRuntimeSystemCore_object.POST_INIT] = function () {
dispatchLifeCycleHook(this, 'didInitAttrs', undefined, this.attrs);
dispatchLifeCycleHook(this, 'didReceiveAttrs', undefined, this.attrs);
}, _Mixin$create.nearestOfType = function (klass) {
@@ -42298,47 +42318,27 @@
return result;
});
rootElement.on(event + '.ember', '[data-ember-action]', function (evt) {
- var actionId = _emberViewsSystemJquery.default(evt.currentTarget).attr('data-ember-action');
- var actions = _emberViewsSystemAction_manager.default.registeredActions[actionId];
+ var attributes = evt.currentTarget.attributes;
- // In Glimmer2 this attribute is set to an empty string and an additional
- // attribute it set for each action on a given element. In this case, the
- // attributes need to be read so that a proper set of action handlers can
- // be coalesced.
- if (actionId === '') {
- var attributes = evt.currentTarget.attributes;
- var attributeCount = attributes.length;
+ for (var i = 0; i < attributes.length; i++) {
+ var attr = attributes.item(i);
+ var attrName = attr.name;
- actions = [];
+ if (attrName.lastIndexOf('data-ember-action-', 0) !== -1) {
+ var action = _emberViewsSystemAction_manager.default.registeredActions[attr.value];
- for (var i = 0; i < attributeCount; i++) {
- var attr = attributes.item(i);
- var attrName = attr.name;
-
- if (attrName.indexOf('data-ember-action-') === 0) {
- actions = actions.concat(_emberViewsSystemAction_manager.default.registeredActions[attr.value]);
+ // We have to check for action here since in some cases, jQuery will trigger
+ // an event on `removeChild` (i.e. focusout) after we've already torn down the
+ // action handlers for the view.
+ if (action && action.eventName === eventName) {
+ action.handler(evt);
}
}
}
-
- // We have to check for actions here since in some cases, jQuery will trigger
- // an event on `removeChild` (i.e. focusout) after we've already torn down the
- // action handlers for the view.
- if (!actions) {
- return;
- }
-
- for (var index = 0; index < actions.length; index++) {
- var action = actions[index];
-
- if (action && action.eventName === eventName) {
- return action.handler(evt);
- }
- }
});
},
_findNearestEventManager: function (view, eventName) {
var manager = null;
@@ -42974,14 +42974,11 @@
/**
@class View
@namespace Ember
@extends Ember.CoreView
@deprecated See http://emberjs.com/deprecations/v1.x/#toc_ember-view
- @uses Ember.ViewSupport
- @uses Ember.ChildViewsSupport
@uses Ember.ClassNamesSupport
- @uses Ember.AttributeBindingsSupport
@private
*/
enifed("ember/features", ["exports"], function (exports) {
"use strict";
@@ -43526,10 +43523,10 @@
// reduced computed macros
enifed("ember/version", ["exports"], function (exports) {
"use strict";
- exports.default = "2.12.0-beta.1";
+ exports.default = "2.12.0-beta.2";
});
enifed('internal-test-helpers/apply-mixins', ['exports', 'ember-utils'], function (exports, _emberUtils) {
'use strict';
exports.default = applyMixins;