dist/ember.debug.js in ember-source-2.5.0.beta.1 vs dist/ember.debug.js in ember-source-2.5.0.beta.4

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2016 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.5.0-beta.1 + * @version 2.5.0-beta.4 */ var enifed, requireModule, require, requirejs, Ember; var mainContext = this; @@ -1320,18 +1320,16 @@ } function lookup(container, fullName) { var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - if (options.source) { - fullName = container.registry.expandLocalLookup(fullName, options); + if (options.source) { + fullName = container.registry.expandLocalLookup(fullName, options); - // if expandLocalLookup returns falsey, we do not support local lookup - if (!fullName) { - return; - } + // if expandLocalLookup returns falsey, we do not support local lookup + if (!fullName) { + return; } } if (container.cache[fullName] !== undefined && options.singleton !== false) { return container.cache[fullName]; @@ -1389,18 +1387,16 @@ function factoryFor(container, fullName) { var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; var registry = container.registry; - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - if (options.source) { - fullName = registry.expandLocalLookup(fullName, options); + if (options.source) { + fullName = registry.expandLocalLookup(fullName, options); - // if expandLocalLookup returns falsey, we do not support local lookup - if (!fullName) { - return; - } + // if expandLocalLookup returns falsey, we do not support local lookup + if (!fullName) { + return; } } var cache = container.factoryCache; if (cache[fullName]) { @@ -2001,14 +1997,13 @@ */ has: function (fullName, options) { _emberMetalDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); var source = undefined; - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - source = options && options.source && this.normalize(options.source); - } + source = options && options.source && this.normalize(options.source); + return has(this, this.normalize(fullName), source); }, /** Allow registering options for all factories of a type. @@ -2371,43 +2366,41 @@ registry.resolver = { resolve: registry.resolver }; } - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - /** - Given a fullName and a source fullName returns the fully resolved - fullName. Used to allow for local lookup. - ```javascript - var registry = new Registry(); - // the twitter factory is added to the module system - registry.expandLocalLookup('component:post-title', { source: 'template:post' }) // => component:post/post-title - ``` - @private - @method expandLocalLookup - @param {String} fullName - @param {Object} [options] - @param {String} [options.source] the fullname of the request source (used for local lookups) - @return {String} fullName - */ - Registry.prototype.expandLocalLookup = function Registry_expandLocalLookup(fullName, options) { - if (this.resolver && this.resolver.expandLocalLookup) { - _emberMetalDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); - _emberMetalDebug.assert('options.source must be provided to expandLocalLookup', options && options.source); - _emberMetalDebug.assert('options.source must be a proper full name', this.validateFullName(options.source)); + /** + Given a fullName and a source fullName returns the fully resolved + fullName. Used to allow for local lookup. + ```javascript + var registry = new Registry(); + // the twitter factory is added to the module system + registry.expandLocalLookup('component:post-title', { source: 'template:post' }) // => component:post/post-title + ``` + @private + @method expandLocalLookup + @param {String} fullName + @param {Object} [options] + @param {String} [options.source] the fullname of the request source (used for local lookups) + @return {String} fullName + */ + Registry.prototype.expandLocalLookup = function Registry_expandLocalLookup(fullName, options) { + if (this.resolver && this.resolver.expandLocalLookup) { + _emberMetalDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberMetalDebug.assert('options.source must be provided to expandLocalLookup', options && options.source); + _emberMetalDebug.assert('options.source must be a proper full name', this.validateFullName(options.source)); - var normalizedFullName = this.normalize(fullName); - var normalizedSource = this.normalize(options.source); + var normalizedFullName = this.normalize(fullName); + var normalizedSource = this.normalize(options.source); - return expandLocalLookup(this, normalizedFullName, normalizedSource); - } else if (this.fallback) { - return this.fallback.expandLocalLookup(fullName, options); - } else { - return null; - } - }; - } + return expandLocalLookup(this, normalizedFullName, normalizedSource); + } else if (this.fallback) { + return this.fallback.expandLocalLookup(fullName, options); + } else { + return null; + } + }; function expandLocalLookup(registry, normalizedName, normalizedSource) { var cache = registry._localLookupCache; var normalizedNameCache = cache[normalizedName]; @@ -2425,20 +2418,18 @@ return normalizedNameCache[normalizedSource] = expanded; } function resolve(registry, normalizedName, options) { - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - if (options && options.source) { - // when `source` is provided expand normalizedName - // and source into the full normalizedName - normalizedName = registry.expandLocalLookup(normalizedName, options); + if (options && options.source) { + // when `source` is provided expand normalizedName + // and source into the full normalizedName + normalizedName = registry.expandLocalLookup(normalizedName, options); - // if expandLocalLookup returns falsey, we do not support local lookup - if (!normalizedName) { - return; - } + // if expandLocalLookup returns falsey, we do not support local lookup + if (!normalizedName) { + return; } } var cached = registry._resolveCache[normalizedName]; if (cached !== undefined) { @@ -3741,26 +3732,20 @@ _emberMetalCore.default.Application = _emberApplicationSystemApplication.default; _emberMetalCore.default.Resolver = _emberApplicationSystemResolver.Resolver; _emberMetalCore.default.DefaultResolver = _emberApplicationSystemResolver.default; - if (_emberMetalFeatures.default('ember-application-engines')) { - _emberMetalCore.default.Engine = _emberApplicationSystemEngine.default; - - // Expose `EngineInstance` and `ApplicationInstance` for easy overriding. - // Reanalyze whether to continue exposing these after feature flag is removed. - _emberMetalCore.default.EngineInstance = _emberApplicationSystemEngineInstance.default; - _emberMetalCore.default.ApplicationInstance = _emberApplicationSystemApplicationInstance.default; - } - _emberRuntimeSystemLazy_load.runLoadHooks('Ember.Application', _emberApplicationSystemApplication.default); }); /** @module ember @submodule ember-application */ + +// Expose `EngineInstance` and `ApplicationInstance` for easy overriding. +// Reanalyze whether to continue exposing these after feature flag is removed. enifed('ember-application/system/application-instance', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/computed', 'ember-htmlbars/system/dom-helper', 'ember-runtime/mixins/registry_proxy', 'ember-metal-views', 'ember-metal/assign', 'ember-metal/environment', 'ember-runtime/ext/rsvp', 'ember-views/system/jquery', 'ember-application/system/engine-instance'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalRun_loop, _emberMetalComputed, _emberHtmlbarsSystemDomHelper, _emberRuntimeMixinsRegistry_proxy, _emberMetalViews, _emberMetalAssign, _emberMetalEnvironment, _emberRuntimeExtRsvp, _emberViewsSystemJquery, _emberApplicationSystemEngineInstance) { /** @module ember @submodule ember-application */ @@ -4254,12 +4239,24 @@ @module ember @submodule ember-application */ 'use strict'; + exports._resetLegacyAddonWarnings = _resetLegacyAddonWarnings; + var librariesRegistered = false; + var warnedAboutLegacyViewAddon = false; + var warnedAboutLegacyControllerAddon = false; + + // For testing + + function _resetLegacyAddonWarnings() { + warnedAboutLegacyViewAddon = false; + warnedAboutLegacyControllerAddon = false; + } + /** An instance of `Ember.Application` is the starting point for every Ember application. It helps to instantiate, initialize and coordinate the many objects that make up your app. @@ -4760,10 +4757,22 @@ _bootSync: function () { if (this._booted) { return; } + if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT && !warnedAboutLegacyViewAddon) { + _emberMetalDebug.deprecate('Support for the `ember-legacy-views` addon will end soon, please remove it from your application.', false, { id: 'ember-legacy-views', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-view' }); + + warnedAboutLegacyViewAddon = true; + } + + if (_emberMetal.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT && !warnedAboutLegacyControllerAddon) { + _emberMetalDebug.deprecate('Support for the `ember-legacy-controllers` addon will end soon, please remove it from your application.', false, { id: 'ember-legacy-controllers', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_objectcontroller' }); + + warnedAboutLegacyControllerAddon = true; + } + // Even though this returns synchronously, we still need to make sure the // boot promise exists for book-keeping purposes: if anything went wrong in // the boot process, we need to store the error as a rejection on the boot // promise so that a future caller of `boot()` can tell what failed. var defer = this._bootResolver = new _emberRuntimeExtRsvp.default.defer(); @@ -6373,11 +6382,12 @@ */ /** Define an assertion that will throw an exception if the condition is not met. Ember build tools will remove any calls to `Ember.assert()` when - doing a production build. Example: + doing an Ember.js framework production build and will make the assertion a + no-op for an application production build. Example: ```javascript // Test for truthiness Ember.assert('Must pass a valid object', obj); @@ -6548,14 +6558,10 @@ if (!_emberMetalCore.default.testing) { // Complain if they're using FEATURE flags in builds other than canary _emberMetalFeatures.FEATURES['features-stripped-test'] = true; var featuresWereStripped = true; - if (_emberMetalFeatures.default('features-stripped-test')) { - exports.featuresWereStripped = featuresWereStripped = false; - } - delete _emberMetalFeatures.FEATURES['features-stripped-test']; _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, featuresWereStripped); // Inform the developer about the Ember Inspector if not installed. var isFirefox = _emberMetalEnvironment.default.isFirefox; @@ -7453,11 +7459,11 @@ ``` Each time the input to a helper changes, the `compute` function will be called again. - As instances, these helpers also have access to the container an will accept + As instances, these helpers also have access to the container and will accept injected dependencies. Additionally, class helpers can call `recompute` to force a new computation. @class Ember.Helper @@ -7967,11 +7973,11 @@ You can also specify a template to show if the property is falsey by using the `else` helper. ```handlebars - {{!Is it raining outside?}} + {{! is it raining outside?}} {{#if isRaining}} Yes, grab an umbrella! {{else}} No, it's lovely outside! {{/if}} @@ -8483,16 +8489,15 @@ var component = undefined, layout = undefined; if (isDasherized || !isAngleBracket) { var options = {}; - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - var moduleName = env.meta && env.meta.moduleName; - if (moduleName) { - options.source = 'template:' + moduleName; - } + var moduleName = env.meta && env.meta.moduleName; + + if (moduleName) { + options.source = 'template:' + moduleName; } var result = _emberHtmlbarsUtilsLookupComponent.default(env.owner, tagName, options); component = result.component; @@ -9126,15 +9131,15 @@ var predicateVal = _emberMetalStreamsUtils.read(predicate); var lengthVal = _emberMetalStreamsUtils.read(length); var isTruthyVal = _emberMetalStreamsUtils.read(isTruthy); if (_emberRuntimeUtils.isArray(predicateVal)) { - return lengthVal > 0 ? predicateVal : false; + return lengthVal > 0 ? coercer(predicateVal) : false; } if (typeof isTruthyVal === 'boolean') { - return isTruthyVal; + return isTruthyVal ? coercer(predicateVal) : false; } return coercer(predicateVal); }, 'ShouldDisplay'); @@ -10559,11 +10564,11 @@ @submodule ember-templates */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.5.0-beta.1'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.5.0-beta.4'; /** The `{{outlet}}` helper lets you specify where a child route will render in your template. An important use of the `{{outlet}}` helper is in your application's `application.hbs` file: @@ -10672,14 +10677,10 @@ ViewClass = env.owner._lookupFactory('view:toplevel'); } var Component; - if (_emberMetalFeatures.default('ember-routing-routable-components')) { - Component = outletState.render.Component; - } - var options; var attrs = {}; if (Component) { options = { component: Component @@ -12504,11 +12505,14 @@ if (!helper) { var owner = env.owner; if (validateLazyHelperName(name, owner, env.hooks.keywords)) { var helperName = 'helper:' + name; - if (owner.hasRegistration(helperName, options)) { + // See https://github.com/emberjs/ember.js/issues/13071 + // See https://bugs.chromium.org/p/v8/issues/detail?id=4839 + var registered = owner.hasRegistration(helperName, options); + if (registered) { helper = owner._lookupFactory(helperName, options); _emberMetalDebug.assert('Expected to find an Ember.Helper with the name ' + helperName + ', but found an object of type ' + typeof helper + ' instead.', helper.isHelperFactory || helper.isHelperInstance); } } } @@ -13690,24 +13694,20 @@ } if (hasComponentOrTemplate(owner, path)) { return true; // global component found } else { - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - var moduleName = env.meta && env.meta.moduleName; + var moduleName = env.meta && env.meta.moduleName; - if (!moduleName) { - // Without a source moduleName, we can not perform local lookups. - return false; - } - - var options = { source: 'template:' + moduleName }; - - return hasComponentOrTemplate(owner, path, options); - } else { + if (!moduleName) { + // Without a source moduleName, we can not perform local lookups. return false; } + + var options = { source: 'template:' + moduleName }; + + return hasComponentOrTemplate(owner, path, options); } } } }); enifed('ember-htmlbars/utils/lookup-component', ['exports', 'ember-metal/features'], function (exports, _emberMetalFeatures) { @@ -13723,19 +13723,17 @@ } function lookupComponent(owner, name, options) { var componentLookup = owner.lookup('component-lookup:main'); - if (_emberMetalFeatures.default('ember-htmlbars-local-lookup')) { - var source = options && options.source; + var source = options && options.source; - if (source) { - var localResult = lookupComponentPair(componentLookup, owner, name, options); + if (source) { + var localResult = lookupComponentPair(componentLookup, owner, name, options); - if (localResult.component || localResult.layout) { - return localResult; - } + if (localResult.component || localResult.layout) { + return localResult; } } return lookupComponentPair(componentLookup, owner, name); } @@ -15414,11 +15412,11 @@ this.firstName = 'Betty'; this.lastName = 'Jones'; }, - fullName: Ember.computed({ + fullName: Ember.computed('firstName', 'lastName', { get(key) { return `${this.get('firstName')} ${this.get('lastName')}`; }, set(key, value) { let [firstName, lastName] = value.split(/\s+/); @@ -16202,11 +16200,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.5.0-beta.1 + @version 2.5.0-beta.4 @public */ if ('undefined' === typeof Ember) { // Create core object. Make it act like an instance of Ember.Namespace so that @@ -16244,15 +16242,15 @@ /** The semantic version. @property VERSION @type String - @default '2.5.0-beta.1' + @default '2.5.0-beta.4' @static @public */ - Ember.VERSION = '2.5.0-beta.1'; + Ember.VERSION = '2.5.0-beta.4'; /** 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 @@ -17353,14 +17351,10 @@ _emberMetalCore.default.Debug.registerDeprecationHandler = function () {}; _emberMetalCore.default.Debug.registerWarnHandler = function () {}; } - _emberMetalDebug.deprecate('Support for the `ember-legacy-views` addon will end soon, please remove it from your application.', !!_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT, { id: 'ember-legacy-views', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-view' }); - - _emberMetalDebug.deprecate('Support for the `ember-legacy-controllers` addon will end soon, please remove it from your application.', !!_emberMetalCore.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT, { id: 'ember-legacy-controllers', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_objectcontroller' }); - _emberMetalCore.default.create = _emberMetalDebug.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create); _emberMetalCore.default.keys = _emberMetalDebug.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); exports.default = _emberMetalCore.default; }); @@ -17887,16 +17881,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'; @@ -18564,13 +18552,11 @@ @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' }); - } + _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; } @@ -25781,16 +25767,10 @@ controllerProto = definedControllerClass.proto(); var controllerDefinedQueryParameterConfiguration = _emberMetalProperty_get.get(controllerProto, 'queryParams'); var normalizedControllerQueryParameterConfiguration = _emberRoutingUtils.normalizeControllerQueryParams(controllerDefinedQueryParameterConfiguration); combinedQueryParameterConfiguration = mergeEachQueryParams(normalizedControllerQueryParameterConfiguration, queryParameterConfiguraton); - - if (_emberMetalFeatures.default('ember-routing-route-configured-query-params')) { - if (controllerDefinedQueryParameterConfiguration.length) { - _emberMetalDebug.deprecate('Configuring query parameters on a controller is deprecated. Migrate the query parameters configuration from the \'' + controllerName + '\' controller to the \'' + this.routeName + '\' route: ' + combinedQueryParameterConfiguration, false, { id: 'ember-routing.controller-configured-query-params', until: '3.0.0' }); - } - } } else if (hasRouterDefinedQueryParams) { // the developer has not defined a controller but *has* supplied route query params. // Generate a class for them so we can later insert default values var generatedControllerClass = _emberRoutingSystemGenerate_controller.generateControllerFactory(_containerOwner.getOwner(this), controllerName); controllerProto = generatedControllerClass.proto(); @@ -25813,23 +25793,10 @@ continue; } var desc = combinedQueryParameterConfiguration[propName]; - if (_emberMetalFeatures.default('ember-routing-route-configured-query-params')) { - // apply default values to controllers - // detect that default value defined on router config - if (desc.hasOwnProperty('defaultValue')) { - // detect that property was not defined on controller - if (controllerProto[propName] === undefined) { - controllerProto[propName] = desc.defaultValue; - } else { - deprecateQueryParamDefaultValuesSetOnController(controllerName, this.routeName, propName); - } - } - } - var scope = desc.scope || 'model'; var parts; if (scope === 'controller') { parts = []; @@ -26360,11 +26327,11 @@ var qpMap = _emberMetalProperty_get.get(this, '_qp').map; var totalChanged = Object.keys(changed).concat(Object.keys(removed)); for (var i = 0, len = totalChanged.length; i < len; ++i) { var qp = qpMap[totalChanged[i]]; - if (qp && _emberMetalProperty_get.get(this._optionsForQueryParam(qp), 'refreshModel')) { + if (qp && _emberMetalProperty_get.get(this._optionsForQueryParam(qp), 'refreshModel') && this.router.currentState) { this.refresh(); } } return true; @@ -27404,11 +27371,11 @@ the Route calls `render`: ```javascript // this.render('post', { // the template name associated with 'post' Route into: 'application', // the parent route to 'post' Route - outlet: 'main', // {{outlet}} and {{outlet 'main' are synonymous}}, + outlet: 'main', // {{outlet}} and {{outlet 'main'}} are synonymous, view: 'post', // the view associated with the 'post' Route controller: 'post', // the controller associated with the 'post' Route }) ``` By default the controller's `model` will be the route's model, so it does not @@ -27633,21 +27600,10 @@ ViewClass: ViewClass, template: template }; var Component = undefined; - if (_emberMetalFeatures.default('ember-routing-routable-components')) { - var componentName = options && options.component || namePassed && name || route.componentName || name; - var componentLookup = owner.lookup('component-lookup:main'); - Component = componentLookup.lookupFactory(componentName); - var isGlimmerComponent = Component && Component.proto().isGlimmerComponent; - if (!template && !ViewClass && Component && isGlimmerComponent) { - renderOptions.Component = Component; - renderOptions.ViewClass = undefined; - renderOptions.attrs = { model: _emberMetalProperty_get.get(controller, 'model') }; - } - } if (!ViewClass && !template && !Component) { _emberMetalDebug.assert('Could not find "' + name + '" template, view, or component.', isDefaultRender); if (LOG_VIEW_LOOKUPS) { var fullName = 'template:' + name; @@ -27711,20 +27667,16 @@ */ function mergeEachQueryParams(controllerQP, routeQP) { var keysAlreadyMergedOrSkippable; var qps = {}; - if (_emberMetalFeatures.default('ember-routing-route-configured-query-params')) { - keysAlreadyMergedOrSkippable = {}; - } else { - keysAlreadyMergedOrSkippable = { - defaultValue: true, - type: true, - scope: true, - as: true - }; - } + keysAlreadyMergedOrSkippable = { + defaultValue: true, + type: true, + scope: true, + as: true + }; // first loop over all controller qps, merging them with any matching route qps // into a new empty object to avoid mutating. for (var cqpName in controllerQP) { if (!controllerQP.hasOwnProperty(cqpName)) { @@ -27767,10 +27719,15 @@ } exports.default = Route; }); // FEATURES, A, deprecate, assert, Logger + +// 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-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'; exports.triggerEvent = triggerEvent; @@ -27947,13 +27904,13 @@ var Router = Ember.Router.extend({ location: config.locationType, didTransition: function() { this._super(...arguments); return ga('send', 'pageview', { - 'page': this.get('url'), - 'title': this.get('url') - }); + 'page': this.get('url'), + 'title': this.get('url') + }); } }); ``` @method didTransition @public @@ -28366,10 +28323,16 @@ _doTransition: function (_targetRouteName, models, _queryParams) { var targetRouteName = _targetRouteName || _emberRoutingUtils.getActiveTargetName(this.router); _emberMetalDebug.assert('The route ' + targetRouteName + ' was not found', targetRouteName && this.router.hasRoute(targetRouteName)); var queryParams = {}; + // merge in any queryParams from the active transition which could include + // queryparams from the url on initial load. + if (this.router.activeTransition) { + _emberMetalAssign.default(queryParams, this.router.activeTransition.queryParams); + } + _emberMetalAssign.default(queryParams, _queryParams); this._prepareQueryParams(targetRouteName, models, queryParams); var transitionArgs = _emberRoutingUtils.routeArgs(targetRouteName, models, queryParams); var transition = this.router.transitionTo.apply(this.router, transitionArgs); @@ -28458,10 +28421,15 @@ }, currentState: null, targetState: null, + _resetTargetState: function () { + var currentState = this.get('currentState'); + this.set('targetState', currentState); + }, + _handleSlowTransition: function (transition, originRoute) { if (!this.router.activeTransition) { // Don't fire an event if we've since moved on from // the transition that put us in a loading state. return; @@ -28831,10 +28799,11 @@ var errorId = _emberMetalUtils.guidFor(error); if (router._isErrorHandled(errorId)) { router._clearHandledError(errorId); } else { + router._resetTargetState(); throw error; } }); } @@ -29379,11 +29348,12 @@ bubble to routes when the controller does not implement the specified action. Once an action hits a route, it will bubble through the route hierarchy. ### Event Propagation - `{{action}}` helpers called in element space can control event bubbling. + `{{action}}` helpers called in element space can control event bubbling. Note + that the closure style actions cannot. Events triggered through the action helper will automatically have `.preventDefault()` called on them. You do not need to do so in your event handlers. If you need to allow event propagation (to handle file inputs for example) you can supply the `preventDefault=false` option to the `{{action}}` helper: @@ -29399,10 +29369,32 @@ ```handlebars <button {{action 'edit' post bubbles=false}}>Edit</button> ``` + To disable bubbling with closure style actions you must create your own + wrapper helper that makes use of `event.stopPropagation()`: + + ```handlebars + <div onclick={{disable-bubbling (action "sayHello")}}>Hello</div> + ``` + + ```js + // app/helpers/disable-bubbling.js + import Ember from 'ember'; + + export function disableBubbling([action]) { + return function(event) { + event.stopPropagation(); + + return action(event); + }; + } + + export default Ember.Helper.helper(disableBubbling); + ``` + If you need the default handler to trigger you should either register your own event handler, or use event methods on your view class. See ["Responding to Browser Events"](/api/classes/Ember.View.html#toc_responding-to-browser-events) in the documentation for Ember.View for more information. @@ -29520,10 +29512,13 @@ } if (!action) { throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.'); } + } else if (action && typeof action[INVOKE] === 'function') { + target = action; + action = action[INVOKE]; } else if (actionType !== 'function') { throw new _emberMetalError.default('An action could not be made for `' + rawAction.label + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + rawAction.label + '\')`) or a function available in ' + target + '.'); } } @@ -29891,28 +29886,29 @@ controllerName = name; controllerFullName = 'controller:' + controllerName; } var parentController = _emberMetalStreamsUtils.read(scope.getLocal('controller')); + var target = parentController || router; var controller; // choose name if (params.length > 1) { var factory = owner._lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(owner, controllerName); controller = factory.create({ model: _emberMetalStreamsUtils.read(context), parentController: parentController, - target: parentController + target: target }); node.addDestruction(controller); } else { controller = owner.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(owner, controllerName); controller.setProperties({ - target: parentController, + target: target, parentController: parentController }); } if (view) { @@ -30328,11 +30324,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.5.0-beta.1'; + _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.5.0-beta.4'; /** `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. @@ -30767,11 +30763,11 @@ var params = _emberMetalProperty_get.get(this, 'params').slice(); _emberMetalDebug.assert('You must provide one or more parameters to the link-to component.', params.length); var disabledWhen = _emberMetalProperty_get.get(this, 'disabledWhen'); - if (disabledWhen) { + if (disabledWhen !== undefined) { this.set('disabled', disabledWhen); } // Process the positional arguments, in order. // 1. Inline link title comes first, if present. @@ -30831,11 +30827,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.5.0-beta.1'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.5.0-beta.4'; var CoreOutletView = _emberViewsViewsView.default.extend({ defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default, init: function () { @@ -30982,23 +30978,12 @@ case 'boolean': case 'number': return spaceship(v, w); case 'string': - // We are comparing Strings using operators instead of `String#localeCompare` - // because of unexpected behavior for certain edge cases. - // For example `'Z'.localeCompare('a')` returns `1`. - // - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Description - if (v < w) { - return -1; - } else if (v === w) { - return 0; - } + return spaceship(v.localeCompare(w), 0); - return 1; - case 'array': var vLen = v.length; var wLen = w.length; var len = Math.min(vLen, wLen); @@ -33310,12 +33295,23 @@ /** Returns a special object that can be used to observe individual properties on the array. Just get an equivalent property on this object and it will return an enumerable that maps automatically to the named key on the member objects. - If you merely want to watch for any items being added or removed to the array, - use the `[]` property instead of `@each`. + @each should only be used in a non-terminal context. Example: + ```javascript + myMethod: computed('posts.@each.author', function(){ + ... + }); + ``` + If you merely want to watch for the array being changed, like an object being + replaced, added or removed, use `[]` instead of `@each`. + ```javascript + myMethod: computed('posts.[]', function(){ + ... + }); + ``` @property @each @public */ '@each': _emberMetalComputed.computed(function () { // TODO use Symbol or add to meta @@ -36869,11 +36865,11 @@ } if (mergedProperties && mergedProperties.length && mergedProperties.indexOf(keyName) >= 0) { var originalValue = this[keyName]; - value = _emberMetalAssign.default(originalValue, value); + value = _emberMetalAssign.default({}, originalValue, value); } if (desc) { desc.set(this, keyName, value); } else { @@ -38816,16 +38812,17 @@ EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default; EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default; EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default; }); -enifed('ember-template-compiler/index', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/plugins/assert-no-each-in', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerPluginsAssertNoEachIn, _emberTemplateCompilerCompat) { +enifed('ember-template-compiler/index', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-closure-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/plugins/assert-no-each-in', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerPluginsAssertNoEachIn, _emberTemplateCompilerCompat) { 'use strict'; _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default); @@ -39049,10 +39046,92 @@ return node.type === 'ComponentNode'; } exports.default = TransformAngleBracketComponents; }); +enifed('ember-template-compiler/plugins/transform-closure-component-attrs-into-mut', ['exports'], function (exports) { + 'use strict'; + + function TransformClosureComponentAttrsIntoMut() { + // set later within HTMLBars to the syntax package + this.syntax = null; + } + + /** + @private + @method transform + @param {AST} ast The AST to be transformed. + */ + TransformClosureComponentAttrsIntoMut.prototype.transform = function TransformClosureComponentAttrsIntoMut_transform(ast) { + var b = this.syntax.builders; + var walker = new this.syntax.Walker(); + + walker.visit(ast, function (node) { + if (validate(node)) { + processExpression(b, node); + } + }); + + return ast; + }; + + function processExpression(builder, node) { + processSubExpressionsInNode(builder, node); + + if (isComponentClosure(node)) { + mutParameters(builder, node); + } + } + + function processSubExpressionsInNode(builder, node) { + for (var i = 0; i < node.params.length; i++) { + if (node.params[i].type === 'SubExpression') { + processExpression(builder, node.params[i]); + } + } + + each(node.hash.pairs, function (pair) { + var value = pair.value; + + if (value.type === 'SubExpression') { + processExpression(builder, value); + } + }); + } + + function isComponentClosure(node) { + return node.type === 'SubExpression' && node.path.original === 'component'; + } + + function mutParameters(builder, node) { + for (var i = 1; i < node.params.length; i++) { + if (node.params[i].type === 'PathExpression') { + node.params[i] = builder.sexpr(builder.path('@mut'), [node.params[i]]); + } + } + + each(node.hash.pairs, function (pair) { + var value = pair.value; + + if (value.type === 'PathExpression') { + pair.value = builder.sexpr(builder.path('@mut'), [pair.value]); + } + }); + } + + function validate(node) { + return node.type === 'BlockStatement' || node.type === 'MustacheStatement'; + } + + function each(list, callback) { + for (var i = 0, l = list.length; i < l; i++) { + callback(list[i]); + } + } + + exports.default = TransformClosureComponentAttrsIntoMut; +}); enifed('ember-template-compiler/plugins/transform-component-attrs-into-mut', ['exports'], function (exports) { 'use strict'; function TransformComponentAttrsIntoMut() { // set later within HTMLBars to the syntax package @@ -39841,11 +39920,11 @@ options.plugins = plugins; options.buildMeta = function buildMeta(program) { return { fragmentReason: fragmentReason(program), - revision: 'Ember@2.5.0-beta.1', + revision: 'Ember@2.5.0-beta.4', loc: program.loc, moduleName: options.moduleName }; }; @@ -41491,10 +41570,11 @@ requirement in web components. @class Component @namespace Ember @extends Ember.View + @uses Ember.ViewTargetActionSupport @public */ var Component = _emberViewsViewsView.default.extend(_emberRuntimeMixinsTarget_action_support.default, { isComponent: true, /* @@ -45262,11 +45342,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.5.0-beta.1'; + _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.5.0-beta.4'; /** @module ember @submodule ember-views */ @@ -47060,25 +47140,24 @@ ```html <use xlink:href="#triangle"></use> ``` If the return value of an `attributeBindings` monitored property is a boolean - the property will follow HTML's pattern of repeating the attribute's name as - its value: + the property's value will be set as a coerced string: ```javascript MyTextInput = Ember.View.extend({ tagName: 'input', attributeBindings: ['disabled'], - disabled: true + disabled: false }); ``` - Will result in view instances with an HTML representation of: + Will result in a view instance with an HTML representation of: ```html - <input id="ember1" class="ember-view" disabled="disabled" /> + <input id="ember1" class="ember-view" disabled="false" /> ``` `attributeBindings` can refer to computed properties: ```javascript @@ -47093,10 +47172,21 @@ } }) }); ``` + To prevent setting an attribute altogether, use `null` or `undefined` as the + return value of the `attributeBindings` monitored property: + + ```javascript + MyTextInput = Ember.View.extend({ + tagName: 'form', + attributeBindings: ['novalidate'], + novalidate: null + }); + ``` + Updates to the property of an attribute binding will result in automatic update of the HTML attribute in the view's rendered HTML representation. `attributeBindings` is a concatenated property. See [Ember.Object](/api/classes/Ember.Object.html) documentation for more information about concatenated properties. @@ -47421,9 +47511,10 @@ @class View @namespace Ember @extends Ember.CoreView @deprecated See http://emberjs.com/deprecations/v1.x/#toc_ember-view + @uses Ember.ViewSupport @uses Ember.ViewContextSupport @uses Ember.ViewChildViewsSupport @uses Ember.TemplateRenderingSupport @uses Ember.ClassNamesSupport @uses Ember.AttributeBindingsSupport