dist/ember.debug.js in ember-source-1.13.10 vs dist/ember.debug.js in ember-source-1.13.11
- old
+ new
@@ -3,11 +3,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 1.13.10
+ * @version 1.13.11
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -126,13 +126,27 @@
this.options.defaultQueue = queueNames[0];
}
this.instanceStack = [];
this._debouncees = [];
this._throttlers = [];
+ this._eventCallbacks = {
+ end: [],
+ begin: []
+ };
+
+ this._timerTimeoutId = undefined;
this._timers = [];
+
+ var _this = this;
+ this._boundRunExpiredTimers = function () {
+ _this._runExpiredTimers();
+ };
}
+ // ms of delay before we conclude a timeout was lost
+ var TIMEOUT_STALLED_THRESHOLD = 1000;
+
Backburner.prototype = {
begin: function () {
var options = this.options;
var onBegin = options && options.onBegin;
var previousInstance = this.currentInstance;
@@ -140,10 +154,11 @@
if (previousInstance) {
this.instanceStack.push(previousInstance);
}
this.currentInstance = new _backburnerDeferredActionQueues["default"](this.queueNames, options);
+ this._trigger('begin', this.currentInstance, previousInstance);
if (onBegin) {
onBegin(this.currentInstance, previousInstance);
}
},
@@ -166,18 +181,72 @@
if (this.instanceStack.length) {
nextInstance = this.instanceStack.pop();
this.currentInstance = nextInstance;
}
-
+ this._trigger('end', currentInstance, nextInstance);
if (onEnd) {
onEnd(currentInstance, nextInstance);
}
}
}
},
+ /**
+ Trigger an event. Supports up to two arguments. Designed around
+ triggering transition events from one run loop instance to the
+ next, which requires an argument for the first instance and then
+ an argument for the next instance.
+ @private
+ @method _trigger
+ @param {String} eventName
+ @param {any} arg1
+ @param {any} arg2
+ */
+ _trigger: function (eventName, arg1, arg2) {
+ var callbacks = this._eventCallbacks[eventName];
+ if (callbacks) {
+ for (var i = 0; i < callbacks.length; i++) {
+ callbacks[i](arg1, arg2);
+ }
+ }
+ },
+
+ on: function (eventName, callback) {
+ if (typeof callback !== 'function') {
+ throw new TypeError('Callback must be a function');
+ }
+ var callbacks = this._eventCallbacks[eventName];
+ if (callbacks) {
+ callbacks.push(callback);
+ } else {
+ throw new TypeError('Cannot on() event "' + eventName + '" because it does not exist');
+ }
+ },
+
+ off: function (eventName, callback) {
+ if (eventName) {
+ var callbacks = this._eventCallbacks[eventName];
+ var callbackFound = false;
+ if (!callbacks) return;
+ if (callback) {
+ for (var i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] === callback) {
+ callbackFound = true;
+ callbacks.splice(i, 1);
+ i--;
+ }
+ }
+ }
+ if (!callbackFound) {
+ throw new TypeError('Cannot off() callback that does not exist');
+ }
+ } else {
+ throw new TypeError('Cannot off() event "' + eventName + '" because it does not exist');
+ }
+ },
+
run: function () /* target, method, args */{
var length = arguments.length;
var method, target, args;
if (length === 1) {
@@ -229,43 +298,64 @@
}
}
}
},
+ /*
+ Join the passed method with an existing queue and execute immediately,
+ if there isn't one use `Backburner#run`.
+ The join method is like the run method except that it will schedule into
+ an existing queue if one already exists. In either case, the join method will
+ immediately execute the passed in function and return its result.
+ @method join
+ @param {Object} target
+ @param {Function} method The method to be executed
+ @param {any} args The method arguments
+ @return method result
+ */
join: function () /* target, method, args */{
- if (this.currentInstance) {
- var length = arguments.length;
- var method, target;
+ if (!this.currentInstance) {
+ return this.run.apply(this, arguments);
+ }
- if (length === 1) {
- method = arguments[0];
- target = null;
- } else {
- target = arguments[0];
- method = arguments[1];
- }
+ var length = arguments.length;
+ var method, target;
- if (_backburnerUtils.isString(method)) {
- method = target[method];
- }
+ if (length === 1) {
+ method = arguments[0];
+ target = null;
+ } else {
+ target = arguments[0];
+ method = arguments[1];
+ }
- if (length === 1) {
- return method();
- } else if (length === 2) {
- return method.call(target);
- } else {
- var args = new Array(length - 2);
- for (var i = 0, l = length - 2; i < l; i++) {
- args[i] = arguments[i + 2];
- }
- return method.apply(target, args);
- }
+ if (_backburnerUtils.isString(method)) {
+ method = target[method];
+ }
+
+ if (length === 1) {
+ return method();
+ } else if (length === 2) {
+ return method.call(target);
} else {
- return this.run.apply(this, arguments);
+ var args = new Array(length - 2);
+ for (var i = 0, l = length - 2; i < l; i++) {
+ args[i] = arguments[i + 2];
+ }
+ return method.apply(target, args);
}
},
+ /*
+ Defer the passed function to run inside the specified queue.
+ @method defer
+ @param {String} queueName
+ @param {Object} target
+ @param {Function|String} method The method or method name to be executed
+ @param {any} args The method arguments
+ @return method result
+ */
defer: function (queueName /* , target, method, args */) {
var length = arguments.length;
var method, target, args;
if (length === 2) {
@@ -404,16 +494,31 @@
} else {
method.apply(target, args);
}
}
+ return this._setTimeout(fn, executeAt);
+ },
+
+ _setTimeout: function (fn, executeAt) {
+ if (this._timers.length === 0) {
+ this._timers.push(executeAt, fn);
+ this._installTimerTimeout();
+ return fn;
+ }
+
+ this._reinstallStalledTimerTimeout();
+
// find position to insert
var i = _backburnerBinarySearch["default"](executeAt, this._timers);
this._timers.splice(i, 0, executeAt, fn);
- updateLaterTimer(this, executeAt, wait);
+ // we should be the new earliest timer if i == 0
+ if (i === 0) {
+ this._reinstallTimerTimeout();
+ }
return fn;
},
throttle: function (target, method /* , args, wait, [immediate] */) {
@@ -507,24 +612,17 @@
return debouncee;
},
cancelTimers: function () {
- var clearItems = function (item) {
- clearTimeout(item[2]);
- };
-
_backburnerUtils.each(this._throttlers, clearItems);
this._throttlers = [];
_backburnerUtils.each(this._debouncees, clearItems);
this._debouncees = [];
- if (this._laterTimer) {
- clearTimeout(this._laterTimer);
- this._laterTimer = null;
- }
+ this._clearTimerTimeout();
this._timers = [];
if (this._autorun) {
clearTimeout(this._autorun);
this._autorun = null;
@@ -545,19 +643,11 @@
// we're cancelling a setTimeout
for (var i = 0, l = this._timers.length; i < l; i += 2) {
if (this._timers[i + 1] === timer) {
this._timers.splice(i, 2); // remove the two elements
if (i === 0) {
- if (this._laterTimer) {
- // Active timer? Then clear timer and reset for future timer
- clearTimeout(this._laterTimer);
- this._laterTimer = null;
- }
- if (this._timers.length > 0) {
- // Update to next available timer when available
- updateLaterTimer(this, this._timers[0], this._timers[0] - _backburnerUtils.now());
- }
+ this._reinstallTimerTimeout();
}
return true;
}
}
} else if (Object.prototype.toString.call(timer) === '[object Array]') {
@@ -587,10 +677,71 @@
return true;
}
}
return false;
+ },
+
+ _runExpiredTimers: function () {
+ this._timerTimeoutId = undefined;
+ this.run(this, this._scheduleExpiredTimers);
+ },
+
+ _scheduleExpiredTimers: function () {
+ var n = _backburnerUtils.now();
+ var timers = this._timers;
+ var i = 0;
+ var l = timers.length;
+ for (; i < l; i += 2) {
+ var executeAt = timers[i];
+ var fn = timers[i + 1];
+ if (executeAt <= n) {
+ this.schedule(this.options.defaultQueue, null, fn);
+ } else {
+ break;
+ }
+ }
+ timers.splice(0, i);
+ this._installTimerTimeout();
+ },
+
+ _reinstallStalledTimerTimeout: function () {
+ if (!this._timerTimeoutId) {
+ return;
+ }
+ // if we have a timer we should always have a this._timerTimeoutId
+ var minExpiresAt = this._timers[0];
+ var delay = _backburnerUtils.now() - minExpiresAt;
+ // threshold of a second before we assume that the currently
+ // installed timeout will not run, so we don't constantly reinstall
+ // timeouts that are delayed but good still
+ if (delay < TIMEOUT_STALLED_THRESHOLD) {
+ return;
+ }
+ },
+
+ _reinstallTimerTimeout: function () {
+ this._clearTimerTimeout();
+ this._installTimerTimeout();
+ },
+
+ _clearTimerTimeout: function () {
+ if (!this._timerTimeoutId) {
+ return;
+ }
+ clearTimeout(this._timerTimeoutId);
+ this._timerTimeoutId = undefined;
+ },
+
+ _installTimerTimeout: function () {
+ if (!this._timers.length) {
+ return;
+ }
+ var minExpiresAt = this._timers[0];
+ var n = _backburnerUtils.now();
+ var wait = Math.max(0, minExpiresAt - n);
+ this._timerTimeoutId = setTimeout(this._boundRunExpiredTimers, wait);
}
};
Backburner.prototype.schedule = Backburner.prototype.defer;
Backburner.prototype.scheduleOnce = Backburner.prototype.deferOnce;
@@ -614,56 +765,10 @@
backburner._autorun = null;
backburner.end();
});
}
- function updateLaterTimer(backburner, executeAt, wait) {
- var n = _backburnerUtils.now();
- if (!backburner._laterTimer || executeAt < backburner._laterTimerExpiresAt || backburner._laterTimerExpiresAt < n) {
-
- if (backburner._laterTimer) {
- // Clear when:
- // - Already expired
- // - New timer is earlier
- clearTimeout(backburner._laterTimer);
-
- if (backburner._laterTimerExpiresAt < n) {
- // If timer was never triggered
- // Calculate the left-over wait-time
- wait = Math.max(0, executeAt - n);
- }
- }
-
- backburner._laterTimer = _backburnerPlatform["default"].setTimeout(function () {
- backburner._laterTimer = null;
- backburner._laterTimerExpiresAt = null;
- executeTimers(backburner);
- }, wait);
-
- backburner._laterTimerExpiresAt = n + wait;
- }
- }
-
- function executeTimers(backburner) {
- var n = _backburnerUtils.now();
- var fns, i, l;
-
- backburner.run(function () {
- i = _backburnerBinarySearch["default"](n, backburner._timers);
-
- fns = backburner._timers.splice(0, i);
-
- for (i = 1, l = fns.length; i < l; i += 2) {
- backburner.schedule(backburner.options.defaultQueue, null, fns[i]);
- }
- });
-
- if (backburner._timers.length) {
- updateLaterTimer(backburner, backburner._timers[0], backburner._timers[0] - n);
- }
- }
-
function findDebouncee(target, method, debouncees) {
return findItem(target, method, debouncees);
}
function findThrottler(target, method, throttlers) {
@@ -682,10 +787,14 @@
}
}
return index;
}
+
+ function clearItems(item) {
+ clearTimeout(item[2]);
+ }
});
enifed("backburner/binary-search", ["exports"], function (exports) {
"use strict";
exports["default"] = binarySearch;
@@ -732,33 +841,40 @@
function noSuchQueue(name) {
throw new Error('You attempted to schedule an action in a queue (' + name + ') that doesn\'t exist');
}
+ function noSuchMethod(name) {
+ throw new Error('You attempted to schedule an action in a queue (' + name + ') for a method that doesn\'t exist');
+ }
+
DeferredActionQueues.prototype = {
schedule: function (name, target, method, args, onceFlag, stack) {
var queues = this.queues;
var queue = queues[name];
if (!queue) {
noSuchQueue(name);
}
+ if (!method) {
+ noSuchMethod(name);
+ }
+
if (onceFlag) {
return queue.pushUnique(target, method, args, stack);
} else {
return queue.push(target, method, args, stack);
}
},
flush: function () {
var queues = this.queues;
var queueNames = this.queueNames;
- var queueName, queue, queueItems, priorQueueNameIndex;
+ var queueName, queue;
var queueNameIndex = 0;
var numberOfQueues = queueNames.length;
- var options = this.options;
while (queueNameIndex < numberOfQueues) {
queueName = queueNames[queueNameIndex];
queue = queues[queueName];
@@ -878,15 +994,10 @@
method: method
};
},
pushUnique: function (target, method, args, stack) {
- var queue = this._queue,
- currentTarget,
- currentMethod,
- i,
- l;
var KEY = this.globalOptions.GUID_KEY;
if (target && KEY) {
var guid = target[KEY];
if (guid) {
@@ -1671,21 +1782,21 @@
lookup: function (fullName, options) {
_emberMetalCore["default"].assert('Create a container on the registry (with `registry.container()`) before calling `lookup`.', this._defaultContainer);
if (instanceInitializersFeatureEnabled) {
- _emberMetalCore["default"].deprecate('`lookup` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
+ _emberMetalCore["default"].deprecate('`lookup` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { id: 'container.calling-lookup-from-registry', until: '2.0.0', url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
}
return this._defaultContainer.lookup(fullName, options);
},
lookupFactory: function (fullName) {
_emberMetalCore["default"].assert('Create a container on the registry (with `registry.container()`) before calling `lookupFactory`.', this._defaultContainer);
if (instanceInitializersFeatureEnabled) {
- _emberMetalCore["default"].deprecate('`lookupFactory` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
+ _emberMetalCore["default"].deprecate('`lookupFactory` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { id: 'container.calling-lookupfactory-from-registry', until: '2.0.0', url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
}
return this._defaultContainer.lookupFactory(fullName);
},
@@ -5341,11 +5452,11 @@
var action = validationAttributes[0];
var factoryFlag = validationAttributes[1];
var expectedType = validationAttributes[2];
if (action === 'deprecate') {
- Ember.deprecate('In Ember 2.0 ' + parsedName.type + ' factories must have an `' + factoryFlag + '` ' + ('property set to true. You registered ' + resolvedType + ' as a ' + parsedName.type + ' ') + ('factory. Either add the `' + factoryFlag + '` property to this factory or ') + ('extend from ' + expectedType + '.'), resolvedType[factoryFlag]);
+ Ember.deprecate('In Ember 2.0 ' + parsedName.type + ' factories must have an `' + factoryFlag + '` ' + ('property set to true. You registered ' + resolvedType + ' as a ' + parsedName.type + ' ') + ('factory. Either add the `' + factoryFlag + '` property to this factory or ') + ('extend from ' + expectedType + '.'), resolvedType[factoryFlag], { id: 'ember-application.validate-type', until: '3.0.0' });
} else {
Ember.assert('Expected ' + parsedName.fullName + ' to resolve to an ' + expectedType + ' but ' + ('instead it was ' + resolvedType + '.'), function () {
return resolvedType[factoryFlag];
});
}
@@ -9589,11 +9700,11 @@
@submodule ember-htmlbars
*/
"use strict";
- _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.10';
+ _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.11';
exports["default"] = {
willRender: function (renderNode, env) {
env.view.ownerView._outlets.push(renderNode);
},
@@ -11526,11 +11637,11 @@
return true;
}
}
function isLegacyBareHelper(helper) {
- return helper && (!helper.isHelperFactory && !helper.isHelperInstance && !helper.isHTMLBars);
+ return helper && !helper.isHelperFactory && !helper.isHelperInstance && !helper.isHTMLBars;
}
/**
Used to lookup/resolve handlebars helpers. The lookup order is:
@@ -13496,11 +13607,11 @@
var i, value;
var result = [];
var length = this.length;
for (i = 0; i < length; i++) {
- if (this.hasOwnProperty(i)) {
+ if (Object.prototype.hasOwnProperty.call(this, i)) {
value = this[i];
if (fn.call(context, value, i, this)) {
result.push(value);
}
}
@@ -15920,11 +16031,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 1.13.10
+ @version 1.13.11
@public
*/
'use strict';
@@ -15954,15 +16065,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '1.13.10'
+ @default '1.13.11'
@static
@public
*/
- Ember.VERSION = '1.13.10';
+ Ember.VERSION = '1.13.11';
/**
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
@@ -24993,19 +25104,19 @@
_emberMetalCore["default"].LinkComponent = _emberRoutingViewsViewsLink["default"];
_emberMetalCore["default"].OutletView = _emberRoutingViewsViewsOutlet.OutletView;
exports["default"] = _emberMetalCore["default"];
});
-enifed("ember-routing-views/views/link", ["exports", "ember-metal/core", "ember-metal/property_get", "ember-metal/property_set", "ember-metal/computed", "ember-views/system/utils", "ember-views/views/component", "ember-runtime/inject", "ember-runtime/mixins/controller", "ember-htmlbars/templates/link-to"], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeMixinsController, _emberHtmlbarsTemplatesLinkTo) {
+enifed("ember-routing-views/views/link", ["exports", "ember-metal/core", "ember-metal/property_get", "ember-metal/computed", "ember-views/system/utils", "ember-views/views/component", "ember-runtime/inject", "ember-runtime/mixins/controller", "ember-htmlbars/hooks/get-value", "ember-htmlbars/templates/link-to"], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalComputed, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeMixinsController, _emberHtmlbarsHooksGetValue, _emberHtmlbarsTemplatesLinkTo) {
/**
@module ember
@submodule ember-routing-views
*/
"use strict";
- _emberHtmlbarsTemplatesLinkTo["default"].meta.revision = 'Ember@1.13.10';
+ _emberHtmlbarsTemplatesLinkTo["default"].meta.revision = 'Ember@1.13.11';
var linkComponentClassNameBindings = ['active', 'loading', 'disabled'];
linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'];
@@ -25389,23 +25500,15 @@
queryParams = params.pop();
} else {
queryParams = {};
}
- if (attrs.disabledClass) {
- this.set('disabledClass', attrs.disabledClass);
- }
-
- if (attrs.activeClass) {
- this.set('activeClass', attrs.activeClass);
- }
-
if (attrs.disabledWhen) {
- this.set('disabled', attrs.disabledWhen);
+ this.set('disabled', _emberHtmlbarsHooksGetValue["default"](attrs.disabledWhen));
}
- var currentWhen = attrs['current-when'];
+ var currentWhen = _emberHtmlbarsHooksGetValue["default"](attrs['current-when']);
if (attrs.currentWhen) {
_emberMetalCore["default"].deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', !attrs.currentWhen);
currentWhen = attrs.currentWhen;
}
@@ -25417,14 +25520,10 @@
// TODO: Change to built-in hasBlock once it's available
if (!attrs.hasBlock) {
this.set('linkTitle', params.shift());
}
- if (attrs.loadingClass) {
- _emberMetalProperty_set.set(this, 'loadingClass', attrs.loadingClass);
- }
-
for (var i = 0; i < params.length; i++) {
var value = params[i];
while (_emberRuntimeMixinsController["default"].detect(value)) {
_emberMetalCore["default"].deprecate('Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated. Please update `' + attrs.view + '` to use `{{link-to "post" someController.model}}` instead.');
@@ -25540,11 +25639,11 @@
@submodule ember-routing-views
*/
"use strict";
- _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.10';
+ _emberHtmlbarsTemplatesTopLevelView["default"].meta.revision = 'Ember@1.13.11';
var CoreOutletView = _emberViewsViewsView["default"].extend({
defaultTemplate: _emberHtmlbarsTemplatesTopLevelView["default"],
init: function () {
@@ -32859,11 +32958,11 @@
// calling `objectAt`
this._super(idx, removedCnt, addedCnt);
},
init: function () {
- _emberMetalCore["default"].deprecate(arrayControllerDeprecation, this.isGenerated, { url: 'http://emberjs.com/guides/deprecations#toc_arraycontroller' });
+ _emberMetalCore["default"].deprecate(arrayControllerDeprecation, this.isGenerated, { id: 'ember-runtime.array-controller', until: '2.0.0', url: 'http://emberjs.com/guides/deprecations#toc_arraycontroller' });
this._super.apply(this, arguments);
this._subControllers = [];
},
@@ -33032,11 +33131,11 @@
@public
**/
exports["default"] = _emberRuntimeSystemObject_proxy["default"].extend(_emberRuntimeMixinsController["default"], {
init: function () {
this._super();
- _emberMetalCore["default"].deprecate(objectControllerDeprecation, this.isGenerated);
+ _emberMetalCore["default"].deprecate(objectControllerDeprecation, this.isGenerated, { id: 'ember-runtime.object-controller', until: '2.0.0' });
}
});
});
enifed('ember-runtime/copy', ['exports', 'ember-metal/enumerable_utils', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, _emberMetalEnumerable_utils, _emberMetalUtils, _emberRuntimeSystemObject, _emberRuntimeMixinsCopyable) {
'use strict';
@@ -37256,10 +37355,15 @@
@default Ember.compare
@private
*/
sortFunction: _emberRuntimeCompare["default"],
+ init: function () {
+ this._super.apply(this, arguments);
+ _emberMetalCore["default"].deprecate("Ember.SortableMixin is deprecated and was used in " + this + ". Please use Ember.computed.sort instead.", this.isGenerated);
+ },
+
orderBy: function (item1, item2) {
var result = 0;
var sortProperties = _emberMetalProperty_get.get(this, 'sortProperties');
var sortAscending = _emberMetalProperty_get.get(this, 'sortAscending');
var sortFunction = _emberMetalProperty_get.get(this, 'sortFunction');
@@ -42538,11 +42642,11 @@
}
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
- revision: 'Ember@1.13.10',
+ revision: 'Ember@1.13.11',
loc: program.loc,
moduleName: options.moduleName
};
};
@@ -46207,10 +46311,12 @@
});
enifed("ember-views/system/build-component-template", ["exports", "htmlbars-runtime", "ember-htmlbars/hooks/get-value", "ember-metal/property_get", "ember-metal/path_cache"], function (exports, _htmlbarsRuntime, _emberHtmlbarsHooksGetValue, _emberMetalProperty_get, _emberMetalPath_cache) {
"use strict";
exports["default"] = buildComponentTemplate;
+ exports.disableInputTypeChanging = disableInputTypeChanging;
+ exports.resetInputTypeChanging = resetInputTypeChanging;
function buildComponentTemplate(_ref, attrs, content) {
var component = _ref.component;
var layout = _ref.layout;
var isAngleBracket = _ref.isAngleBracket;
@@ -46235,11 +46341,11 @@
// If this is not a tagless component, we need to create the wrapping
// element. We use `manualElement` to create a template that represents
// the wrapping element and yields to the previous block.
if (tagName !== '') {
- var attributes = normalizeComponentAttributes(component, isAngleBracket, attrs);
+ var attributes = normalizeComponentAttributes(component, isAngleBracket, attrs, tagName);
var elementTemplate = _htmlbarsRuntime.internal.manualElement(tagName, attributes);
elementTemplate.meta = meta;
blockToRender = createElementBlock(elementTemplate, blockToRender, component);
} else {
@@ -46252,10 +46358,36 @@
// * the falsy value "" if set explicitly on the component
// * an actual tagName set explicitly on the component
return { createdElement: !!tagName, block: blockToRender };
}
+ // Static flag used to see if we can mutate the type attribute on input elements. IE8
+ // does not support changing the type attribute after an element is inserted in
+ // a tree.
+ var isInputTypeAttributeMutable = (function () {
+ var docFragment = document.createDocumentFragment();
+ var mutableInputTypeTextElement = document.createElement('input');
+ mutableInputTypeTextElement.type = 'text';
+ try {
+ docFragment.appendChild(mutableInputTypeTextElement);
+ mutableInputTypeTextElement.setAttribute('type', 'password');
+ } catch (e) {
+ return false;
+ }
+ return true;
+ })();
+
+ var canChangeInputType = isInputTypeAttributeMutable;
+
+ function disableInputTypeChanging() {
+ canChangeInputType = false;
+ }
+
+ function resetInputTypeChanging() {
+ canChangeInputType = isInputTypeAttributeMutable;
+ }
+
function blockFor(template, options) {
Ember.assert("BUG: Must pass a template to blockFor", !!template);
return _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, options);
}
@@ -46322,11 +46454,12 @@
return tagName;
}
// Takes a component and builds a normalized set of attribute
// bindings consumable by HTMLBars' `attribute` hook.
- function normalizeComponentAttributes(component, isAngleBracket, attrs) {
+ function normalizeComponentAttributes(component, isAngleBracket, attrs, tagName) {
+ var hardCodeType = tagName === 'input' && !canChangeInputType;
var normalized = {};
var attributeBindings = component.attributeBindings;
var i, l;
if (attrs.id && _emberHtmlbarsHooksGetValue["default"](attrs.id)) {
@@ -46344,21 +46477,36 @@
var attrName, expression;
if (colonIndex !== -1) {
var attrProperty = attr.substring(0, colonIndex);
attrName = attr.substring(colonIndex + 1);
- expression = ['get', 'view.' + attrProperty];
+
+ if (attrName === 'type' && hardCodeType) {
+ expression = component.get(attrProperty) + '';
+ } else {
+ expression = ['get', 'view.' + attrProperty];
+ }
} else if (attrs[attr]) {
// TODO: For compatibility with 1.x, we probably need to `set`
// the component's attribute here if it is a CP, but we also
// probably want to suspend observers and allow the
// willUpdateAttrs logic to trigger observers at the correct time.
attrName = attr;
- expression = ['value', attrs[attr]];
+
+ if (attrName === 'type' && hardCodeType) {
+ expression = _emberHtmlbarsHooksGetValue["default"](attrs[attr]) + '';
+ } else {
+ expression = ['value', attrs[attr]];
+ }
} else {
attrName = attr;
- expression = ['get', 'view.' + attr];
+
+ if (attrName === 'type' && hardCodeType) {
+ expression = component.get(attr) + '';
+ } else {
+ expression = ['get', 'view.' + attr];
+ }
}
Ember.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', attrName !== 'class');
normalized[attrName] = expression;
@@ -47540,11 +47688,11 @@
@property template
@public
*/
template: _emberMetalComputed.computed({
get: function () {
- _emberMetalCore["default"].deprecate("Accessing 'template' in " + this + " is deprecated. To determine if a block was specified to " + this + " please use '{{#if hasBlock}}' in the components layout.");
+ _emberMetalCore["default"].deprecate("Accessing 'template' in " + this + " is deprecated. To determine if a block was specified to " + this + " please use '{{#if hasBlock}}' in the components layout.", false, { id: 'ember-views.accessing-template', until: '2.0.0' });
return _emberMetalProperty_get.get(this, '_template');
},
set: function (key, value) {
@@ -47790,11 +47938,11 @@
});
// Ember.assert, Ember.Handlebars
enifed("ember-views/views/container_view", ["exports", "ember-metal/core", "ember-runtime/mixins/mutable_array", "ember-views/views/view", "ember-metal/property_get", "ember-metal/property_set", "ember-metal/enumerable_utils", "ember-metal/mixin", "ember-metal/events", "ember-htmlbars/templates/container-view"], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEnumerable_utils, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
"use strict";
- _emberHtmlbarsTemplatesContainerView["default"].meta.revision = 'Ember@1.13.10';
+ _emberHtmlbarsTemplatesContainerView["default"].meta.revision = 'Ember@1.13.11';
/**
@module ember
@submodule ember-views
*/
@@ -49344,11 +49492,13 @@
@public
*/
value: "",
/**
- The `type` attribute of the input element.
+ The `type` attribute of the input element. To remain compatible with IE8, this
+ cannot change after the element has been rendered. It is suggested to avoid using
+ a dynamic type attribute if you are supporting IE8 since it will be set once and never change.
@property type
@type String
@default "text"
@public
*/
@@ -50659,18 +50809,18 @@
},
scheduleRevalidate: function (node, label, manualRerender) {
if (node && !this._dispatching && node.guid in this.env.renderedNodes) {
if (manualRerender) {
- _emberMetalCore["default"].deprecate("You manually rerendered " + label + " (a parent component) from a child component during the rendering process. This rarely worked in Ember 1.x and will be removed in Ember 2.0");
+ _emberMetalCore["default"].deprecate("You manually rerendered " + label + " (a parent component) from a child component during the rendering process. This rarely worked in Ember 1.x and will be removed in Ember 3.0", false, { id: 'ember-views.manual-parent-rerender', until: '3.0.0' });
} else {
- _emberMetalCore["default"].deprecate("You modified " + label + " twice in a single render. This was unreliable in Ember 1.x and will be removed in Ember 2.0");
+ _emberMetalCore["default"].deprecate("You modified " + label + " twice in a single render. This was unreliable in Ember 1.x and will be removed in Ember 3.0", false, { id: 'ember-views.render-double-modify', until: '3.0.0' });
}
_emberMetalRun_loop["default"].scheduleOnce('render', this, this.revalidate);
return;
}
- _emberMetalCore["default"].deprecate("A property of " + this + " was modified inside the " + this._dispatching + " hook. You should never change properties on components, services or models during " + this._dispatching + " because it causes significant performance degradation.", !this._dispatching);
+ _emberMetalCore["default"].deprecate("A property of " + this + " was modified inside the " + this._dispatching + " hook. You should never change properties on components, services or models during " + this._dispatching + " because it causes significant performance degradation.", !this._dispatching, { id: 'ember-views.dispatching-modify-property', until: '3.0.0' });
if (!this.scheduledRevalidation || this._dispatching) {
this.scheduledRevalidation = true;
_emberMetalRun_loop["default"].scheduleOnce('render', this, this.revalidate);
}
\ No newline at end of file