dist/ember.js in ember-source-2.3.0.beta.3 vs dist/ember.js in ember-source-2.3.0

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2015 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.3.0-beta.3 + * @version 2.3.0 */ var enifed, requireModule, require, requirejs, Ember; var mainContext = this; @@ -3974,11 +3974,11 @@ ``` Not all combinations of the supported options are valid. See the documentation on `Ember.Application#visit` for the supported configurations. Internal, experimental or otherwise unstable flags are marked as private. @class BootOptions - @namespace @Ember.ApplicationInstance + @namespace Ember.ApplicationInstance @public */ BootOptions = function BootOptions() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; @@ -7580,11 +7580,11 @@ /** The `{{#each}}` helper loops over elements in a collection. It is an extension of the base Handlebars `{{#each}}` helper. The default behavior of `{{#each}}` is to yield its inner block once for every - item in an array. + item in an array passing the item as the first block parameter. ```javascript var developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}]; ``` @@ -7605,10 +7605,20 @@ {{#each developerNames key="@index" as |name|}} {{name}} {{/each}} ``` + During iteration, the index of each item in the array is provided as a second block parameter. + + ```handlebars + <ul> + {{#each people as |person index|}} + <li>Hello, {{person.name}}! You're number {{index}} in line</li> + {{/each}} + </ul> + ``` + ### Specifying Keys The `key` option is used to tell Ember how to determine if the array being iterated over with `{{#each}}` has changed between renders. By helping Ember detect that some elements in the array are the same, DOM elements can be @@ -8153,11 +8163,11 @@ if (renderNode.cleanup) { renderNode.cleanup(); } } }); -enifed('ember-htmlbars/hooks/component', ['exports', 'ember-metal/debug', 'ember-htmlbars/node-managers/component-node-manager', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-metal/cache', 'ember-htmlbars/system/lookup-helper', 'ember-htmlbars/keywords/closure-component'], function (exports, _emberMetalDebug, _emberHtmlbarsNodeManagersComponentNodeManager, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberMetalCache, _emberHtmlbarsSystemLookupHelper, _emberHtmlbarsKeywordsClosureComponent) { +enifed('ember-htmlbars/hooks/component', ['exports', 'ember-metal/debug', 'ember-htmlbars/node-managers/component-node-manager', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-metal/assign', 'ember-metal/empty_object', 'ember-metal/cache', 'ember-htmlbars/system/lookup-helper', 'ember-htmlbars/keywords/closure-component'], function (exports, _emberMetalDebug, _emberHtmlbarsNodeManagersComponentNodeManager, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberMetalAssign, _emberMetalEmpty_object, _emberMetalCache, _emberHtmlbarsSystemLookupHelper, _emberHtmlbarsKeywordsClosureComponent) { 'use strict'; exports.default = componentHook; var IS_ANGLE_CACHE = new _emberMetalCache.default(1000, function (key) { @@ -8184,13 +8194,14 @@ * Therefore, when rendering a closure component with the component * helper we process the parameters and attributes and then merge those * on top of the closure component attributes. * */ - _emberHtmlbarsKeywordsClosureComponent.processPositionalParamsFromCell(componentCell, params, attrs); + var newAttrs = _emberMetalAssign.default(new _emberMetalEmpty_object.default(), attrs); + _emberHtmlbarsKeywordsClosureComponent.processPositionalParamsFromCell(componentCell, params, newAttrs); params = []; - attrs = _emberHtmlbarsKeywordsClosureComponent.mergeInNewHash(componentCell[_emberHtmlbarsKeywordsClosureComponent.COMPONENT_HASH], attrs); + attrs = _emberHtmlbarsKeywordsClosureComponent.mergeInNewHash(componentCell[_emberHtmlbarsKeywordsClosureComponent.COMPONENT_HASH], newAttrs); } } // Determine if this is an initial render or a re-render if (state.manager) { @@ -9031,11 +9042,11 @@ // untouched. This view is then cleared once cleanup is complete in // `didCleanupTree`. view.ownerView._destroyingSubtreeForView = view; } }); -enifed('ember-htmlbars/keywords/closure-component', ['exports', 'ember-metal/debug', 'ember-metal/is_none', 'ember-metal/symbol', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-htmlbars/hooks/subexpr', 'ember-metal/assign', 'ember-htmlbars/utils/extract-positional-params', 'ember-htmlbars/utils/lookup-component'], function (exports, _emberMetalDebug, _emberMetalIs_none, _emberMetalSymbol, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberHtmlbarsHooksSubexpr, _emberMetalAssign, _emberHtmlbarsUtilsExtractPositionalParams, _emberHtmlbarsUtilsLookupComponent) { +enifed('ember-htmlbars/keywords/closure-component', ['exports', 'ember-metal/debug', 'ember-metal/is_none', 'ember-metal/symbol', 'ember-metal/streams/stream', 'ember-metal/empty_object', 'ember-metal/streams/utils', 'ember-htmlbars/hooks/subexpr', 'ember-metal/assign', 'ember-htmlbars/utils/extract-positional-params', 'ember-htmlbars/utils/lookup-component'], function (exports, _emberMetalDebug, _emberMetalIs_none, _emberMetalSymbol, _emberMetalStreamsStream, _emberMetalEmpty_object, _emberMetalStreamsUtils, _emberHtmlbarsHooksSubexpr, _emberMetalAssign, _emberHtmlbarsUtilsExtractPositionalParams, _emberHtmlbarsUtilsLookupComponent) { /** @module ember @submodule ember-templates */ @@ -9096,15 +9107,17 @@ function createClosureComponentCell(env, originalComponentPath, params, hash, label) { var componentPath = _emberMetalStreamsUtils.read(originalComponentPath); _emberMetalDebug.assert('Component path cannot be null in ' + label, !_emberMetalIs_none.default(componentPath)); + var newHash = _emberMetalAssign.default(new _emberMetalEmpty_object.default(), hash); + if (isComponentCell(componentPath)) { - return createNestedClosureComponentCell(componentPath, params, hash); + return createNestedClosureComponentCell(componentPath, params, newHash); } else { _emberMetalDebug.assert('The component helper cannot be used without a valid component name. You used "' + componentPath + '" via ' + label, isValidComponentPath(env, componentPath)); - return createNewClosureComponentCell(env, componentPath, params, hash); + return createNewClosureComponentCell(env, componentPath, params, newHash); } } function isValidComponentPath(env, path) { var result = _emberHtmlbarsUtilsLookupComponent.default(env.owner, path); @@ -10122,11 +10135,11 @@ @submodule ember-templates */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.3.0-beta.3'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.3.0'; /** The `{{outlet}}` helper lets you specify where a child routes will render in your template. An important use of the `{{outlet}}` helper is in your application's `application.hbs` file: @@ -15869,11 +15882,11 @@ cross-platform libraries such as jQuery. For more details, see [Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html). @class Ember @static - @version 2.3.0-beta.3 + @version 2.3.0 @public */ 'use strict'; @@ -15913,15 +15926,15 @@ /** The semantic version. @property VERSION @type String - @default '2.3.0-beta.3' + @default '2.3.0' @static @public */ - Ember.VERSION = '2.3.0-beta.3'; + Ember.VERSION = '2.3.0'; /** The hash of environment variables used to control various configuration settings. To specify your own or override default settings, add the desired properties to a global hash named `EmberENV` (or `ENV` for @@ -17333,16 +17346,10 @@ this._registry.splice(index, 1); } } }; - if (_emberMetalFeatures.default('ember-libraries-isregistered')) { - Libraries.prototype.isRegistered = function (name) { - return !!this._getLibraryByName(name); - }; - } - exports.default = Libraries; }); enifed('ember-metal/logger', ['exports', 'ember-metal/core', 'ember-metal/error'], function (exports, _emberMetalCore, _emberMetalError) { 'use strict'; @@ -18010,13 +18017,10 @@ @return {Object} @public */ function merge(original, updates) { - if (_emberMetalFeatures.default('ember-metal-ember-assign')) { - _emberMetalDebug.deprecate('Usage of `Ember.merge` is deprecated, use `Ember.assign` instead.', false, { id: 'ember-metal.merge', until: '3.0.0' }); - } if (!updates || typeof updates !== 'object') { return original; } @@ -21000,11 +21004,11 @@ return backburner.later.apply(backburner, args); }; /** Cancels a scheduled item. Must be a value returned by `run.later()`, - `run.once()`, `run.next()`, `run.debounce()`, or + `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or `run.throttle()`. ```javascript var runNext = run.next(myContext, function() { // will not be executed @@ -21016,10 +21020,16 @@ // will not be executed }, 500); run.cancel(runLater); + var runScheduleOnce = run.scheduleOnce('afterRender', myContext, function() { + // will not be executed + }); + + run.cancel(runScheduleOnce); + var runOnce = run.once(myContext, function() { // will not be executed }); run.cancel(runOnce); @@ -27141,11 +27151,11 @@ // apply default values to controllers // detect that default value defined on router config // detect that property was not defined on controller -enifed('ember-routing/system/router', ['exports', 'ember-metal/logger', 'ember-metal/debug', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/empty_object', 'ember-metal/computed', 'ember-metal/assign', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', 'ember-routing/system/router_state', 'container/owner', 'router', 'router/transition'], function (exports, _emberMetalLogger, _emberMetalDebug, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalEmpty_object, _emberMetalComputed, _emberMetalAssign, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _emberRoutingSystemRouter_state, _containerOwner, _router4, _routerTransition) { +enifed('ember-routing/system/router', ['exports', 'ember-metal/logger', 'ember-metal/debug', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/empty_object', 'ember-metal/computed', 'ember-metal/assign', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', 'ember-metal/utils', 'ember-routing/system/router_state', 'container/owner', 'ember-metal/dictionary', 'router', 'router/transition'], function (exports, _emberMetalLogger, _emberMetalDebug, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalEmpty_object, _emberMetalComputed, _emberMetalAssign, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _emberMetalUtils, _emberRoutingSystemRouter_state, _containerOwner, _emberMetalDictionary, _router4, _routerTransition) { 'use strict'; function K() { return this; } @@ -27219,10 +27229,11 @@ init: function () { this._activeViews = {}; this._qpCache = new _emberMetalEmpty_object.default(); this._resetQueuedQueryParameterChanges(); + this._handledErrors = _emberMetalDictionary.default(null); }, /* Resets all pending query paramter changes. Called after transitioning to a new route @@ -27386,12 +27397,11 @@ return this._doURLTransition('handleURL', url); }, _doURLTransition: function (routerJsMethod, url) { var transition = this.router[routerJsMethod](url || '/'); - didBeginTransition(transition, this); - return transition; + return didBeginTransition(transition, this); }, transitionTo: function () { var queryParams; @@ -27816,10 +27826,24 @@ _cancelSlowTransitionTimer: function () { if (this._slowTransitionTimer) { _emberMetalRun_loop.default.cancel(this._slowTransitionTimer); } this._slowTransitionTimer = null; + }, + + // These three helper functions are used to ensure errors aren't + // re-raised if they're handled in a route's error action. + _markErrorAsHandled: function (errorGuid) { + this._handledErrors[errorGuid] = true; + }, + + _isErrorHandled: function (errorGuid) { + return this._handledErrors[errorGuid]; + }, + + _clearHandledError: function (errorGuid) { + delete this._handledErrors[errorGuid]; } }); /* Helper function for iterating root-ward, starting @@ -27985,10 +28009,15 @@ if (handler.actions && handler.actions[name]) { if (handler.actions[name].apply(handler, args) === true) { eventWasHandled = true; } else { + // Should only hit here if a non-bubbling error action is triggered on a route. + if (name === 'error') { + var errorId = _emberMetalUtils.guidFor(args[0]); + handler.router._markErrorAsHandled(errorId); + } return; } } } @@ -28142,10 +28171,20 @@ if (!router.currentState) { router.set('currentState', routerState); } router.set('targetState', routerState); + + return transition.catch(function (error) { + var errorId = _emberMetalUtils.guidFor(error); + + if (router._isErrorHandled(errorId)) { + router._clearHandledError(errorId); + } else { + throw error; + } + }); } function resemblesURL(str) { return typeof str === 'string' && (str === '' || str.charAt(0) === '/'); } @@ -28874,11 +28913,11 @@ closureAction[ACTION] = true; return closureAction; } }); -enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalDebug, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) { +enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/streams/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalDebug, _emberMetalUtils, _emberMetalStreamsUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) { 'use strict'; exports.default = { setupState: function (state, env, scope, params, hash) { var getStream = env.hooks.get; @@ -28953,19 +28992,19 @@ } actions.push({ eventName: eventName, handler: function (event) { - if (!isAllowedEvent(event, allowedKeys)) { + if (!isAllowedEvent(event, _emberMetalStreamsUtils.read(allowedKeys))) { return true; } - if (preventDefault !== false) { + if (_emberMetalStreamsUtils.read(preventDefault) !== false) { event.preventDefault(); } - if (bubbles === false) { + if (_emberMetalStreamsUtils.read(bubbles) === false) { event.stopPropagation(); } var _node$getState = node.getState(); @@ -29634,11 +29673,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.3.0-beta.3'; + _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.3.0'; /** `Ember.LinkComponent` renders an element whose `click` event triggers a transition of the application's instance of `Ember.Router` to a supplied route by name. @@ -30124,11 +30163,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.3.0-beta.3'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.3.0'; var CoreOutletView = _emberViewsViewsView.default.extend({ defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default, init: function () { @@ -38890,13 +38929,10 @@ return; } if (lastComponentNode.type === 'ComponentNode') { componentCallback(lastComponentNode); - } else if (_emberMetalFeatures.default('ember-htmlbars-component-generation')) { - var component = elementCallback(lastComponentNode); - body.splice(lastIndex, 1, component); } } exports.default = TransformTopLevelComponents; }); @@ -39045,13 +39081,10 @@ @property compileOptions */ exports.default = function (_options) { var disableComponentGeneration = true; - if (_emberMetalFeatures.default('ember-htmlbars-component-generation')) { - disableComponentGeneration = false; - } var options = undefined; // When calling `Ember.Handlebars.compile()` a second argument of `true` // had a special meaning (long since lost), this just gaurds against // `options` being true, and causing an error during compilation. @@ -39073,11 +39106,11 @@ options.plugins = plugins; options.buildMeta = function buildMeta(program) { return { fragmentReason: fragmentReason(program), - revision: 'Ember@2.3.0-beta.3', + revision: 'Ember@2.3.0', loc: program.loc, moduleName: options.moduleName }; }; @@ -43702,11 +43735,11 @@ // after bindings have synced, and a queue for scheduling actions // that that should occur after view rendering. _emberMetalRun_loop.default._addQueue('render', 'actions'); _emberMetalRun_loop.default._addQueue('afterRender', 'render'); }); -enifed('ember-views/system/jquery', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalEnvironment) { +enifed('ember-views/system/jquery', ['exports', 'ember-metal/core', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalEnvironment) { 'use strict'; var jQuery; if (_emberMetalEnvironment.default.hasDOM) { @@ -43714,12 +43747,10 @@ jQuery = _emberMetalCore.default.imports && _emberMetalCore.default.imports.jQuery || mainContext && mainContext.jQuery; //jshint ignore:line if (!jQuery && typeof require === 'function') { jQuery = require('jquery'); } - _emberMetalDebug.assert('Ember Views require jQuery between 1.7 and 2.1', jQuery && (jQuery().jquery.match(/^((1\.(7|8|9|10|11))|(2\.(0|1)))(\.\d+)?(pre|rc\d?)?/) || _emberMetalCore.default.ENV.FORCE_JQUERY)); - if (jQuery) { // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents var dragEvents = ['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend']; // Copies the `dataTransfer` property from a browser event object onto the @@ -44363,11 +44394,11 @@ exports.DeprecatedCollectionView = DeprecatedCollectionView; }); enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-runtime/mixins/mutable_array', 'ember-runtime/system/native_array', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/mixin', 'ember-metal/events', 'ember-htmlbars/templates/container-view'], function (exports, _emberMetalCore, _emberMetalDebug, _emberRuntimeMixinsMutable_array, _emberRuntimeSystemNative_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) { 'use strict'; - _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.3.0-beta.3'; + _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.3.0'; /** @module ember @submodule ember-views */ @@ -47733,11 +47764,11 @@ This hook is responsible for updating a render node that represents a range of content with a value. */ function range(morph, env, scope, path, value, visitor) { - if (handleRedirect(morph, env, scope, path, [value], {}, null, null, visitor)) { + if (handleRedirect(morph, env, scope, path, [], {}, null, null, visitor)) { return; } value = env.hooks.getValue(value); @@ -49686,11 +49717,11 @@ case 'object': if (typeof content.nodeType === 'number') { return this.setNode(content); } /* Handlebars.SafeString */ - if (typeof content.string === 'string') { - return this.setHTML(content.string); + if (typeof content.toHTML === 'function') { + return this.setHTML(content.toHTML()); } if (this.parseTextAsHTML) { return this.setHTML(content.toString()); } /* falls through */