dist/ember.js in ember-source-1.0.0.rc3.2 vs dist/ember.js in ember-source-1.0.0.rc3.3

- old
+ new

@@ -1,7 +1,7 @@ -// Version: v1.0.0-rc.3-112-g3ec3711 -// Last commit: 3ec3711 (2013-04-27 22:06:48 -0700) +// Version: v1.0.0-rc.3-130-g99bc3b5 +// Last commit: 99bc3b5 (2013-04-29 12:12:25 -0700) (function() { /*global __fail__*/ @@ -149,12 +149,12 @@ }; }; })(); -// Version: v1.0.0-rc.3-112-g3ec3711 -// Last commit: 3ec3711 (2013-04-27 22:06:48 -0700) +// Version: v1.0.0-rc.3-156-g9d1d3cd +// Last commit: 9d1d3cd (2013-05-01 22:51:16 -0700) (function() { var define, requireModule; @@ -6708,11 +6708,15 @@ this.on('promise:failed', function(event) { this.trigger('error', { detail: event.detail }); }, this); - resolver(resolvePromise, rejectPromise); + try { + resolver(resolvePromise, rejectPromise); + } catch(e) { + rejectPromise(e); + } }; var invokeCallback = function(type, promise, callback, event) { var hasCallback = isFunction(callback), value, error, succeeded, failed; @@ -6833,10 +6837,32 @@ __exports__.Promise = Promise; }); +define("rsvp/reject", + ["rsvp/promise","exports"], + function(__dependency1__, __exports__) { + "use strict"; + var Promise = __dependency1__.Promise; + + + function objectOrFunction(x) { + return typeof x === "function" || (typeof x === "object" && x !== null); + } + + + function reject(reason) { + return new Promise(function (resolve, reject) { + reject(reason); + }); + } + + + __exports__.reject = reject; + }); + define("rsvp/resolve", ["rsvp/promise","exports"], function(__dependency1__, __exports__) { "use strict"; var Promise = __dependency1__.Promise; @@ -6875,21 +6901,22 @@ __exports__.resolve = resolve; }); define("rsvp", - ["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/defer","rsvp/config","rsvp/resolve","exports"], - function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) { + ["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"], + function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __exports__) { "use strict"; var EventTarget = __dependency1__.EventTarget; var Promise = __dependency2__.Promise; var denodeify = __dependency3__.denodeify; var all = __dependency4__.all; var hash = __dependency5__.hash; var defer = __dependency6__.defer; var config = __dependency7__.config; var resolve = __dependency8__.resolve; + var reject = __dependency9__.reject; function configure(name, value) { config[name] = value; } @@ -6900,10 +6927,11 @@ __exports__.hash = hash; __exports__.defer = defer; __exports__.denodeify = denodeify; __exports__.configure = configure; __exports__.resolve = resolve; + __exports__.reject = reject; }); })(); (function() { @@ -10796,15 +10824,11 @@ return resolve(entity); } else { return resolve(fulfillment); } }, function(reason) { - if (reason === promise) { - return reject(entity); - } else { - return reject(reason); - } + return reject(reason); }); }, /** Resolve a Deferred object and call any `doneCallbacks` with the given args. @@ -13069,16 +13093,19 @@ store: null, model: Ember.computed.alias('content'), send: function(actionName) { - var args = [].slice.call(arguments, 1), target; + var args = [].slice.call(arguments, 1), target, + bubble = true; if (this[actionName]) { Ember.assert("The controller " + this + " does not have the action " + actionName, typeof this[actionName] === 'function'); - this[actionName].apply(this, args); - } else if(target = get(this, 'target')) { + bubble = this[actionName].apply(this, args) === true; + } + + if (bubble && (target = get(this, 'target'))) { Ember.assert("The target for controller " + this + " (" + target + ") did not define a `send` method", typeof target.send === 'function'); target.send.apply(target, arguments); } } }); @@ -14398,11 +14425,11 @@ @param {String} eventName the name of the method to call on the view */ setupHandler: function(rootElement, event, eventName) { var self = this; - rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) { + rootElement.on(event + '.ember', '.ember-view', function(evt, triggeringManager) { return Ember.handleErrors(function() { var view = Ember.View.views[this.id], result = true, manager = null; manager = self._findNearestEventManager(view,eventName); @@ -14417,11 +14444,11 @@ return result; }, this); }); - rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) { + rootElement.on(event + '.ember', '[data-ember-action]', function(evt) { return Ember.handleErrors(function() { var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'), action = Ember.Handlebars.ActionHelper.registeredActions[actionId]; // We have to check for action here since in some cases, jQuery will trigger @@ -14469,11 +14496,11 @@ }); }, destroy: function() { var rootElement = get(this, 'rootElement'); - Ember.$(rootElement).undelegate('.ember').removeClass('ember-application'); + Ember.$(rootElement).off('.ember', '**').removeClass('ember-application'); return this._super(); } }); })(); @@ -15466,11 +15493,13 @@ }).property('layoutName'), templateForName: function(name, type) { if (!name) { return; } Ember.assert("templateNames are not allowed to contain periods: "+name, name.indexOf('.') === -1); - var container = this.container; + + // the defaultContainer is deprecated + var container = this.container || (Ember.Container && Ember.Container.defaultContainer); return container && container.lookup('template:' + name); }, /** The object from which templates should access properties. @@ -18712,11 +18741,12 @@ var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars); if(!Handlebars && typeof require === 'function') { Handlebars = require('handlebars'); } -Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars && Handlebars.COMPILER_REVISION === 2); +Ember.assert("Ember Handlebars requires Handlebars version 1.0.0-rc.3. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars) +Ember.assert("Ember Handlebars requires Handlebars version 1.0.0-rc.3, COMPILER_REVISION 2. Builds of master may have other COMPILER_REVISION values.", Handlebars.COMPILER_REVISION === 2); /** Prepares the Handlebars templating library for use inside Ember's view system. @@ -22759,11 +22789,11 @@ normalizeHash(hash, types); if (inputType === 'checkbox') { return Ember.Handlebars.helpers.view.call(this, Ember.Checkbox, options); } else { - hash.type = inputType; + hash.type = inputType || 'text'; hash.onEvent = onEvent || 'enter'; return Ember.Handlebars.helpers.view.call(this, Ember.TextField, options); } }); @@ -23685,11 +23715,10 @@ var handler = router.getHandler('loading'); if (handler) { if (handler.enter) { handler.enter(); } if (handler.setup) { handler.setup(); } - if (handler.setupTemplate) { handler.setupTemplate(); } } } } /** @@ -23725,14 +23754,13 @@ `setup` method. */ function failure(router, error) { loaded(router); var handler = router.getHandler('failure'); - if (handler){ + if (handler) { if (handler.enter) { handler.enter(); } if (handler.setup) { handler.setup(error); } - if (handler.setupTemplate) { handler.setupTemplate(error); } } } /** @private @@ -23858,11 +23886,11 @@ var partition = partitionHandlers(router.currentHandlerInfos || [], handlerInfos); router.targetHandlerInfos = handlerInfos; - eachHandler(partition.exited, function(handler, context, handlerInfo) { + eachHandler(partition.exited, function(handler, context) { delete handler.context; if (handler.exit) { handler.exit(); } }); var currentHandlerInfos = partition.unchanged.slice(); @@ -23876,24 +23904,20 @@ var aborted = false; eachHandler(partition.entered, function(handler, context, handlerInfo) { if (aborted) { return; } if (handler.enter) { handler.enter(); } - setContext(handler, context); - if (handler.setup) { if (false === handler.setup(context)) { aborted = true; } } + if (!aborted) { - if (handler.setupTemplate) { - handler.setupTemplate(context); - } currentHandlerInfos.push(handlerInfo); - } + } }); if (!aborted && router.didTransition) { router.didTransition(handlerInfos); } @@ -24001,30 +24025,38 @@ if (!currentHandlerInfos) { throw new Error("Could not trigger event '" + name + "'. There are no active handlers"); } + var eventWasHandled = false; + for (var i=currentHandlerInfos.length-1; i>=0; i--) { var handlerInfo = currentHandlerInfos[i], handler = handlerInfo.handler; if (handler.events && handler.events[name]) { - handler.events[name].apply(handler, args); - return; + if (handler.events[name].apply(handler, args) === true) { + eventWasHandled = true; + } else { + return; + } } } - throw new Error("Nothing handled the event '" + name + "'."); + if (!eventWasHandled) { + throw new Error("Nothing handled the event '" + name + "'."); + } } function setContext(handler, context) { handler.context = context; if (handler.contextDidChange) { handler.contextDidChange(); } } return Router; }); + })(); (function() { @@ -24639,30 +24671,19 @@ Ember.deprecate("Ember.Route.setupControllers is deprecated. Please use Ember.Route.setupController(controller, model) instead."); this.setupControllers(controller, context); } else { this.setupController(controller, context); } - }, - /** - @private - - This hook is an entry point for router.js. It is invoked when - we're entering a route, after the route's context has been setup. - - @method setupTemplate - */ - setupTemplate: function(context) { if (this.renderTemplates) { Ember.deprecate("Ember.Route.renderTemplates is deprecated. Please use Ember.Route.renderTemplate(controller, model) instead."); this.renderTemplates(context); } else { - this.renderTemplate(this.controller, context); + this.renderTemplate(controller, context); } }, - /** A hook you can implement to optionally redirect to another route. If you call `this.transitionTo` from inside of this hook, this route will not be entered in favor of the other hook. @@ -24989,11 +25010,11 @@ function parentTemplate(route, isRecursive) { var parent = parentRoute(route), template; if (!parent) { return; } - Ember.warn(fmt("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected", get(parent, 'routeName'), get(route, 'routeName')), !isRecursive); + Ember.warn(fmt("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected", [get(parent, 'routeName'), get(route, 'routeName')]), !isRecursive); if (template = parent.lastRenderedTemplate) { return template; } else { return parentTemplate(parent, true); @@ -25221,20 +25242,28 @@ tagName: 'a', namedRoute: null, currentWhen: null, title: null, activeClass: 'active', + disabledClass: 'disabled', + _isDisabled: false, replace: false, attributeBindings: ['href', 'title'], - classNameBindings: 'active', + classNameBindings: ['active', 'disabled'], // Even though this isn't a virtual view, we want to treat it as if it is // so that you can access the parent with {{view.prop}} concreteView: Ember.computed(function() { return get(this, 'parentView'); }).property('parentView'), + disabled: Ember.computed(function(key, value) { + if (value !== undefined) { this.set('_isDisabled', value); } + + return value ? this.get('disabledClass') : false; + }), + active: Ember.computed(function() { var router = this.get('router'), params = resolvedPaths(this.parameters), currentWithIndex = this.currentWhen + '.index', isActive = router.isActive.apply(router, [this.currentWhen].concat(params)) || @@ -25250,10 +25279,12 @@ click: function(event) { if (!isSimpleClick(event)) { return true; } event.preventDefault(); if (this.bubbles === false) { event.stopPropagation(); } + + if (get(this, '_isDisabled')) { return false; } var router = this.get('router'); if (Ember.ENV.ENABLE_ROUTE_TO) { @@ -25445,10 +25476,11 @@ var hash = options.hash; hash.namedRoute = name; hash.currentWhen = hash.currentWhen || name; + hash.disabledBinding = hash.disabledWhen; hash.parameters = { context: this, options: options, params: params @@ -25559,19 +25591,27 @@ var get = Ember.get, set = Ember.set; Ember.onLoad('Ember.Handlebars', function(Handlebars) { /** - Renders the named template in the current context using the singleton - instance of the same-named controller. + Renders the named template in the current context with the same-named + controller. - If a view class with the same name exists, uses the view class. + If a view class with the same name exists, the view class will be used. - If a `model` is specified, it becomes the model for that controller. + The optional second argument is a property path that will be bound + to the `model` property of the controller. + If a `model` property path is specified, then a new instance of the + controller will be created. + + If no `model` property path is provided, then the helper will use the + singleton instance of the controller. A given controller may only be used + one time in your app in this manner. + The default target for `{{action}}`s in the rendered template is the - named controller. + controller. @method render @for Ember.Handlebars.helpers @param {String} name @param {Object?} contextString @@ -26324,11 +26364,11 @@ */ onUpdateURL: function(callback) { var self = this; var guid = Ember.guidFor(this); - Ember.$(window).bind('hashchange.ember-location-'+guid, function() { + Ember.$(window).on('hashchange.ember-location-'+guid, function() { Ember.run(function() { var path = location.hash.substr(1); if (get(self, 'lastSetURL') === path) { return; } set(self, 'lastSetURL', null); @@ -26511,11 +26551,11 @@ */ onUpdateURL: function(callback) { var guid = Ember.guidFor(this), self = this; - Ember.$(window).bind('popstate.ember-location-'+guid, function(e) { + Ember.$(window).on('popstate.ember-location-'+guid, function(e) { // Ignore initial page load popstate event in Chrome if(!popstateFired) { popstateFired = true; if (self.getURL() === self._previousURL) { return; } } @@ -26899,10 +26939,30 @@ @submodule ember-application */ var get = Ember.get, set = Ember.set; +function DeprecatedContainer(container) { + this._container = container; +} + +DeprecatedContainer.deprecate = function(method) { + return function() { + var container = this._container; + + Ember.deprecate('Using the defaultContainer is no longer supported. [defaultContainer#' + method + ']', false); + container[method].apply(container, arguments); + }; +}; + +DeprecatedContainer.prototype = { + _container: null, + lookup: DeprecatedContainer.deprecate('lookup'), + resolve: DeprecatedContainer.deprecate('resolve'), + register: DeprecatedContainer.deprecate('register') +}; + /** 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. @@ -27501,10 +27561,12 @@ @return {Ember.Container} the built container */ buildContainer: function(namespace) { var container = new Ember.Container(); + Ember.Container.defaultContainer = new DeprecatedContainer(container); + container.set = Ember.set; container.normalize = normalize; container.resolver = resolverFor(namespace); container.optionsForType('view', { singleton: false }); container.optionsForType('template', { instantiate: false }); @@ -29069,11 +29131,11 @@ })(); })(); -// Version: v1.0.0-rc.3-112-g3ec3711 -// Last commit: 3ec3711 (2013-04-27 22:06:48 -0700) +// Version: v1.0.0-rc.3-156-g9d1d3cd +// Last commit: 9d1d3cd (2013-05-01 22:51:16 -0700) (function() { /** Ember