dist/ember.js in ember-source-2.13.3 vs dist/ember.js in ember-source-2.13.4

- old
+ new

@@ -4,11 +4,11 @@ * @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.13.3 + * @version 2.13.4 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -3227,11 +3227,18 @@ function wrapManagerInDeprecationProxy(manager) { if (_emberUtils.HAS_NATIVE_PROXY) { var _ret = (function () { var validator = { get: function (obj, prop) { - if (prop !== 'class' && prop !== 'create') { + if (typeof prop === 'symbol') { + return obj[prop]; + } + if (prop === 'inspect') { + return undefined; /* for nodes formatter */ + } + + if (prop !== 'class' && prop !== 'create' && prop !== 'toString') { throw new Error('You attempted to access "' + prop + '" on a factory manager created by container#factoryFor. "' + prop + '" is not a member of a factory manager."'); } return obj[prop]; }, @@ -12812,67 +12819,10 @@ 'use strict'; exports.inlineIf = inlineIf; exports.inlineUnless = inlineUnless; - /** - Use the `if` block helper to conditionally render a block depending on a - property. If the property is "falsey", for example: `false`, `undefined`, - `null`, `""`, `0`, `NaN` or an empty array, the block will not be rendered. - - ```handlebars - {{! will not render if foo is falsey}} - {{#if foo}} - Welcome to the {{foo.bar}} - {{/if}} - ``` - - You can also specify a template to show if the property is falsey by using - the `else` helper. - - ```handlebars - {{! is it raining outside?}} - {{#if isRaining}} - Yes, grab an umbrella! - {{else}} - No, it's lovely outside! - {{/if}} - ``` - - You are also able to combine `else` and `if` helpers to create more complex - conditional logic. - - ```handlebars - {{#if isMorning}} - Good morning - {{else if isAfternoon}} - Good afternoon - {{else}} - Good night - {{/if}} - ``` - - You can use `if` inline to conditionally render a single property or string. - This helper acts like a ternary operator. If the first property is truthy, - the second argument will be displayed, if not, the third argument will be - displayed - - ```handlebars - {{if useLongGreeting "Hello" "Hi"}} Dave - ``` - - Finally, you can use the `if` helper inside another helper as a subexpression. - - ```handlebars - {{some-component height=(if isBig "100" "10")}} - ``` - - @method if - @for Ember.Templates.helpers - @public - */ - var ConditionalHelperReference = (function (_CachedReference) { babelHelpers.inherits(ConditionalHelperReference, _CachedReference); ConditionalHelperReference.create = function create(_condRef, _truthyRef, _falsyRef) { var condRef = _emberGlimmerUtilsReferences.ConditionalReference.create(_condRef); @@ -12898,25 +12848,87 @@ this.truthy = truthy; this.falsy = falsy; } /** + The `if` helper allows you to conditionally render one of two branches, + depending on the "truthiness" of a property. + For example the following values are all falsey: `false`, `undefined`, `null`, `""`, `0`, `NaN` or an empty array. + + This helper has two forms, block and inline. + + ## Block form + + You can use the block form of `if` to conditionally render a section of the template. + + To use it, pass the conditional value to the `if` helper, + using the block form to wrap the section of template you want to conditionally render. + Like so: + + ```handlebars + {{! will not render if foo is falsey}} + {{#if foo}} + Welcome to the {{foo.bar}} + {{/if}} + ``` + + You can also specify a template to show if the property is falsey by using + the `else` helper. + + ```handlebars + {{! is it raining outside?}} + {{#if isRaining}} + Yes, grab an umbrella! + {{else}} + No, it's lovely outside! + {{/if}} + ``` + + You are also able to combine `else` and `if` helpers to create more complex + conditional logic. + + ```handlebars + {{#if isMorning}} + Good morning + {{else if isAfternoon}} + Good afternoon + {{else}} + Good night + {{/if}} + ``` + + ## Inline form + The inline `if` helper conditionally renders a single property or string. - This helper acts like a ternary operator. If the first property is truthy, - the second argument will be displayed, otherwise, the third argument will be - displayed + In this form, the `if` helper receives three arguments, the conditional value, + the value to render when truthy, and the value to render when falsey. + + For example, if `useLongGreeting` is truthy, the following: + ```handlebars {{if useLongGreeting "Hello" "Hi"}} Alex ``` - You can use the `if` helper inside another helper as a subexpression. + Will render: + ```html + Hello Alex + ``` + + ### Nested `if` + + You can use the `if` helper inside another helper as a nested helper: + ```handlebars {{some-component height=(if isBig "100" "10")}} ``` + One detail to keep in mind is that both branches of the `if` helper will be evaluated, + so if you have `{{if condition "foo" (expensive-operation "bar")`, + `expensive-operation` will always calculate. + @method if @for Ember.Templates.helpers @public */ @@ -17107,10 +17119,26 @@ exports.UPDATE = UPDATE; exports.NULL_REFERENCE = _glimmerRuntime.NULL_REFERENCE; exports.UNDEFINED_REFERENCE = _glimmerRuntime.UNDEFINED_REFERENCE; + var maybeFreeze = undefined; + _emberDebug.runInDebug(function () { + // gaurding this in a DEBUG gaurd (as well as all invocations) + // so that it is properly stripped during the minification's + // dead code elimination + maybeFreeze = function (obj) { + // re-freezing an already frozen object introduces a significant + // performance penalty on Chrome (tested through 59). + // + // See: https://bugs.chromium.org/p/v8/issues/detail?id=6450 + if (!Object.isFrozen(obj) && _emberUtils.HAS_NATIVE_WEAKMAP) { + Object.freeze(obj); + } + }; + }); + // @abstract // @implements PathReference var EmberPathReference = (function () { function EmberPathReference() { @@ -17454,14 +17482,12 @@ var positionalValue = positional.value(); var namedValue = named.value(); _emberDebug.runInDebug(function () { - if (_emberUtils.HAS_NATIVE_WEAKMAP) { - Object.freeze(positionalValue); - Object.freeze(namedValue); - } + maybeFreeze(positionalValue); + maybeFreeze(namedValue); }); var result = helper(positionalValue, namedValue); if (result === null) { @@ -17507,14 +17533,12 @@ var positionalValue = positional.value(); var namedValue = named.value(); _emberDebug.runInDebug(function () { - if (_emberUtils.HAS_NATIVE_WEAKMAP) { - Object.freeze(positionalValue); - Object.freeze(namedValue); - } + maybeFreeze(positionalValue); + maybeFreeze(namedValue); }); return helper(positionalValue, namedValue); }; @@ -17550,14 +17574,12 @@ var positionalValue = positional.value(); var namedValue = named.value(); _emberDebug.runInDebug(function () { - if (_emberUtils.HAS_NATIVE_WEAKMAP) { - Object.freeze(positionalValue); - Object.freeze(namedValue); - } + maybeFreeze(positionalValue); + maybeFreeze(namedValue); }); return instance.compute(positionalValue, namedValue); }; @@ -35705,20 +35727,20 @@ return this.every(iter.apply(this, arguments)); }, /** Returns `true` if the passed function returns true for any item in the - enumeration. This corresponds with the `some()` method in JavaScript 1.6. + enumeration. The callback method you provide should have the following signature (all parameters are optional): ```javascript function(item, index, enumerable); ``` - `item` is the current item in the iteration. - `index` is the current index in the iteration. - `enumerable` is the enumerable object itself. - It should return the `true` to include the item in the results, `false` + It should return `true` to include the item in the results, `false` otherwise. Note that in addition to a callback, you can also pass an optional target object that will be set as `this` on the context. This is a good way to give your iterator function access to the current object. Usage Example: @@ -45571,10 +45593,10 @@ // reduced computed macros enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.13.3"; + exports.default = "2.13.4"; }); enifed('internal-test-helpers/apply-mixins', ['exports', 'ember-utils'], function (exports, _emberUtils) { 'use strict'; exports.default = applyMixins;