upgrade ember to f1ec52aaa0713c7edeca237d38f172e0671a4c0e

This commit is contained in:
Sven Fuchs 2012-09-14 13:32:12 +02:00
parent 23ffffff36
commit 37521c1d90
3 changed files with 515 additions and 407 deletions

View File

@ -1,5 +1,5 @@
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
(function() { (function() {
@ -142,8 +142,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})(); })();
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre-5-gf1ec52a
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() { (function() {
@ -1011,6 +1011,8 @@ function canInvoke(obj, methodName) {
/** /**
Checks to see if the `methodName` exists on the `obj`. Checks to see if the `methodName` exists on the `obj`.
@function
@param {Object} obj The object to check for the method @param {Object} obj The object to check for the method
@param {String} methodName The method name to check for @param {String} methodName The method name to check for
*/ */
@ -1700,8 +1702,22 @@ var Descriptor = Ember.Descriptor = function() {};
return this.firstName+' '+this.lastName; return this.firstName+' '+this.lastName;
}).property('firstName', 'lastName').cacheable()); }).property('firstName', 'lastName').cacheable());
*/ */
Ember.defineProperty = function(obj, keyName, desc, val, meta) { Ember.defineProperty = function(obj, keyName, desc, data, meta) {
var descs, existingDesc, watching; // The first two parameters to defineProperty are mandatory:
//
// * obj: the object to define this property on. This may be
// a prototype.
// * keyName: the name of the property
//
// One and only one of the following two parameters must be
// provided:
//
// * desc: an instance of Ember.Descriptor (typically a
// computed property) or an ES5 descriptor.
// * data: something other than a descriptor, that will
// become the explicit value of this property.
var descs, existingDesc, watching, value;
if (!meta) meta = metaFor(obj); if (!meta) meta = metaFor(obj);
descs = meta.descs; descs = meta.descs;
@ -1713,6 +1729,8 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} }
if (desc instanceof Ember.Descriptor) { if (desc instanceof Ember.Descriptor) {
value = desc;
descs[keyName] = desc; descs[keyName] = desc;
if (MANDATORY_SETTER && watching) { if (MANDATORY_SETTER && watching) {
objectDefineProperty(obj, keyName, { objectDefineProperty(obj, keyName, {
@ -1728,8 +1746,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} else { } else {
descs[keyName] = undefined; // shadow descriptor in proto descs[keyName] = undefined; // shadow descriptor in proto
if (desc == null) { if (desc == null) {
value = data;
if (MANDATORY_SETTER && watching) { if (MANDATORY_SETTER && watching) {
meta.values[keyName] = val; meta.values[keyName] = data;
objectDefineProperty(obj, keyName, { objectDefineProperty(obj, keyName, {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
@ -1742,9 +1762,11 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} }
}); });
} else { } else {
obj[keyName] = val; obj[keyName] = data;
} }
} else { } else {
value = desc;
// compatibility with ES5 // compatibility with ES5
objectDefineProperty(obj, keyName, desc); objectDefineProperty(obj, keyName, desc);
} }
@ -1754,6 +1776,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
// were initialized with the prototype // were initialized with the prototype
if (watching) { Ember.overrideChains(obj, keyName, meta); } if (watching) { Ember.overrideChains(obj, keyName, meta); }
// The `value` passed to the `didDefineProperty` hook is
// either the descriptor or data, whichever was passed.
if (obj.didDefineProperty) { obj.didDefineProperty(obj, keyName, value); }
return this; return this;
}; };
@ -2102,8 +2128,6 @@ function flushPendingChains() {
forEach.call(queue, function(q) { q[0].add(q[1]); }); forEach.call(queue, function(q) { q[0].add(q[1]); });
Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0); Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0);
if(pendingQueue.length > 0)
console.log(pendingQueue)
} }
/** @private */ /** @private */
@ -2789,7 +2813,9 @@ var ComputedPropertyPrototype = ComputedProperty.prototype;
Properties are cacheable by default. Properties are cacheable by default.
@name Ember.ComputedProperty.cacheable @memberOf Ember.ComputedProperty.prototype
@name cacheable
@function
@param {Boolean} aFlag optional set to false to disable caching @param {Boolean} aFlag optional set to false to disable caching
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
@ -2808,7 +2834,9 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
}.property().volatile() }.property().volatile()
}); });
@name Ember.ComputedProperty.volatile @memberOf Ember.ComputedProperty.prototype
@name volatile
@function
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
ComputedPropertyPrototype.volatile = function() { ComputedPropertyPrototype.volatile = function() {
@ -2828,7 +2856,9 @@ ComputedPropertyPrototype.volatile = function() {
}).property('firstName', 'lastName') }).property('firstName', 'lastName')
}); });
@name Ember.ComputedProperty.property @memberOf Ember.ComputedProperty.prototype
@name property
@function
@param {String} path... zero or more property paths @param {String} path... zero or more property paths
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
@ -2859,14 +2889,20 @@ ComputedPropertyPrototype.property = function() {
exposes a public API for retrieving these values from classes, exposes a public API for retrieving these values from classes,
via the `metaForProperty()` function. via the `metaForProperty()` function.
@name Ember.ComputedProperty.meta @memberOf Ember.ComputedProperty.prototype
@param {Hash} metadata @name meta
@function
@param {Hash} meta
@returns {Ember.ComputedProperty} property descriptor instance @returns {Ember.ComputedProperty} property descriptor instance
*/ */
ComputedPropertyPrototype.meta = function(meta) { ComputedPropertyPrototype.meta = function(meta) {
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta; this._meta = meta;
return this; return this;
}
}; };
/** @private - impl descriptor API */ /** @private - impl descriptor API */
@ -4914,6 +4950,17 @@ Ember.observer = function(func) {
return func; return func;
}; };
// If observers ever become asynchronous, Ember.immediateObserver
// must remain synchronous.
Ember.immediateObserver = function() {
for (var i=0, l=arguments.length; i<l; i++) {
var arg = arguments[i];
Ember.assert("Immediate observers must observe internal properties only, not properties on other objects.", typeof arg !== "string" || arg.indexOf('.') === -1);
}
return Ember.observer.apply(this, arguments);
};
Ember.beforeObserver = function(func) { Ember.beforeObserver = function(func) {
var paths = a_slice.call(arguments, 1); var paths = a_slice.call(arguments, 1);
func.__ember_observesBefore__ = paths; func.__ember_observesBefore__ = paths;
@ -7012,6 +7059,7 @@ Ember.Copyable = Ember.Mixin.create(
Override to return a copy of the receiver. Default implementation raises Override to return a copy of the receiver. Default implementation raises
an exception. an exception.
@function
@param deep {Boolean} if true, a deep copy of the object should be made @param deep {Boolean} if true, a deep copy of the object should be made
@returns {Object} copy of receiver @returns {Object} copy of receiver
*/ */
@ -7208,6 +7256,8 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
If the passed object is of a type not supported by the receiver If the passed object is of a type not supported by the receiver
then this method should raise an exception. then this method should raise an exception.
@function
@param {Object} object @param {Object} object
The object to add to the enumerable. The object to add to the enumerable.
@ -7238,6 +7288,8 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
If the passed object is of a type not supported by the receiver If the passed object is of a type not supported by the receiver
then this method should raise an exception. then this method should raise an exception.
@function
@param {Object} object @param {Object} object
The object to remove from the enumerable. The object to remove from the enumerable.
@ -7308,6 +7360,8 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
should replace amt objects started at idx with the objects in the passed should replace amt objects started at idx with the objects in the passed
array. You should also call this.enumerableContentDidChange() ; array. You should also call this.enumerableContentDidChange() ;
@function
@param {Number} idx @param {Number} idx
Starting index in the array to replace. If idx >= length, then append Starting index in the array to replace. If idx >= length, then append
to the end of the array. to the end of the array.
@ -10316,6 +10370,8 @@ var get = Ember.get, set = Ember.set;
perhaps be moved so that it's visible in the JsDoc output. perhaps be moved so that it's visible in the JsDoc output.
*/ */
/** /**
@class
Ember.Location returns an instance of the correct implementation of Ember.Location returns an instance of the correct implementation of
the `location` API. the `location` API.
@ -10348,11 +10404,18 @@ Ember.Location = {
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.HashLocation implements the location API using the browser's Ember.HashLocation implements the location API using the browser's
hash. At present, it relies on a hashchange event existing in the hash. At present, it relies on a hashchange event existing in the
browser. browser.
@extends Ember.Object
*/ */
Ember.HashLocation = Ember.Object.extend({ Ember.HashLocation = Ember.Object.extend(
/** @scope Ember.HashLocation.prototype */ {
/** @private */
init: function() { init: function() {
set(this, 'location', get(this, 'location') || window.location); set(this, 'location', get(this, 'location') || window.location);
}, },
@ -10412,6 +10475,7 @@ Ember.HashLocation = Ember.Object.extend({
return '#'+url; return '#'+url;
}, },
/** @private */
willDestroy: function() { willDestroy: function() {
var guid = Ember.guidFor(this); var guid = Ember.guidFor(this);
@ -10429,10 +10493,17 @@ Ember.Location.registerImplementation('hash', Ember.HashLocation);
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.HistoryLocation implements the location API using the browser's Ember.HistoryLocation implements the location API using the browser's
history.pushState API. history.pushState API.
@extends Ember.Object
*/ */
Ember.HistoryLocation = Ember.Object.extend({ Ember.HistoryLocation = Ember.Object.extend(
/** @scope Ember.HistoryLocation.prototype */ {
/** @private */
init: function() { init: function() {
set(this, 'location', get(this, 'location') || window.location); set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname); set(this, '_initialURL', get(this, 'location').pathname);
@ -10470,8 +10541,7 @@ Ember.HistoryLocation = Ember.Object.extend({
path = this.formatPath(path); path = this.formatPath(path);
if ((initialURL && initialURL !== path) || (state && state.path !== path)) { if ((initialURL !== path && !state) || (state && state.path !== path)) {
set(this, '_initialURL', null);
window.history.pushState({ path: path }, null, path); window.history.pushState({ path: path }, null, path);
} }
}, },
@ -10515,6 +10585,7 @@ Ember.HistoryLocation = Ember.Object.extend({
return url; return url;
}, },
/** @private */
willDestroy: function() { willDestroy: function() {
var guid = Ember.guidFor(this); var guid = Ember.guidFor(this);
@ -10532,12 +10603,17 @@ Ember.Location.registerImplementation('history', Ember.HistoryLocation);
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.NoneLocation does not interact with the browser. It is useful for Ember.NoneLocation does not interact with the browser. It is useful for
testing, or when you need to manage state with your Router, but temporarily testing, or when you need to manage state with your Router, but temporarily
don't want it to muck with the URL (for example when you embed your don't want it to muck with the URL (for example when you embed your
application in a larger page). application in a larger page).
@extends Ember.Object
*/ */
Ember.NoneLocation = Ember.Object.extend({ Ember.NoneLocation = Ember.Object.extend(
/** @scope Ember.NoneLocation.prototype */ {
path: '', path: '',
getURL: function() { getURL: function() {
@ -12092,10 +12168,6 @@ Ember.View = Ember.Object.extend(Ember.Evented,
_parentView: null, _parentView: null,
// allow navigation between the next and previous views
prevView: null,
nextView: null,
// return the current view, not including virtual views // return the current view, not including virtual views
concreteView: Ember.computed(function() { concreteView: Ember.computed(function() {
if (!this.isVirtual) { return this; } if (!this.isVirtual) { return this; }
@ -12461,6 +12533,8 @@ Ember.View = Ember.Object.extend(Ember.Evented,
// JavaScript property changes. // JavaScript property changes.
var observer = function() { var observer = function() {
elem = this.$(); elem = this.$();
if (!elem) { return; }
attributeValue = get(this, property); attributeValue = get(this, property);
Ember.View.applyAttributeBindings(elem, attributeName, attributeValue); Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);
@ -13272,9 +13346,12 @@ Ember.View = Ember.Object.extend(Ember.Evented,
element of the actual DOM element. element of the actual DOM element.
*/ */
_isVisibleDidChange: Ember.observer(function() { _isVisibleDidChange: Ember.observer(function() {
var $el = this.$();
if (!$el) { return; }
var isVisible = get(this, 'isVisible'); var isVisible = get(this, 'isVisible');
this.$().toggle(isVisible); $el.toggle(isVisible);
if (this._isAncestorHidden()) { return; } if (this._isAncestorHidden()) { return; }
@ -13407,22 +13484,10 @@ var DOMManager = {
}); });
}, },
after: function(parentView, view, newView) { after: function(view, nextView) {
newView._insertElementLater(function() { nextView._insertElementLater(function() {
var nextView; var element = view.$();
var prevView = view; element.after(nextView.$());
while (prevView !== null && prevView.get('state') !== 'inDOM') {
prevView=prevView.get('prevView');
}
var element;
if (prevView === null) {
element = parentView.$();
element.prepend(newView.$());
} else {
element = prevView.$();
element.after(newView.$());
}
}); });
}, },
@ -13590,7 +13655,7 @@ Ember.View.states = {
}, },
$: function() { $: function() {
return Ember.$(); return undefined;
}, },
getElement: function() { getElement: function() {
@ -13695,13 +13760,7 @@ Ember.View.states.inBuffer = {
var buffer = view.buffer; var buffer = view.buffer;
childView = this.createChildView(childView, options); childView = this.createChildView(childView, options);
var childViews = get(view, '_childViews'); view._childViews.push(childView);
if (childViews.length > 0) {
childViews[childViews.length-1].nextView = childView;
childView.prevView = childViews[childViews.length-1];
}
childViews.push(childView);
childView.renderToBuffer(buffer); childView.renderToBuffer(buffer);
@ -14120,10 +14179,6 @@ Ember.ContainerView = Ember.View.extend({
view = this.createChildView(viewName); view = this.createChildView(viewName);
} }
if (idx>0) {
_childViews[idx-1].nextView = view;
view.prevView = _childViews[idx-1];
}
_childViews[idx] = view; _childViews[idx] = view;
}, this); }, this);
@ -14239,7 +14294,7 @@ Ember.ContainerView = Ember.View.extend({
*/ */
_scheduleInsertion: function(view, prev) { _scheduleInsertion: function(view, prev) {
if (prev) { if (prev) {
prev.domManager.after(this, prev, view); prev.domManager.after(prev, view);
} else { } else {
this.domManager.prepend(this, view); this.domManager.prepend(this, view);
} }
@ -14560,15 +14615,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
if (removingAll) { childView.removedFromDOM = true; } if (removingAll) { childView.removedFromDOM = true; }
childView.destroy(); childView.destroy();
} }
// If there is an element before the ones we deleted
if (start>0) {
childViews[start-1].set('nextView', start<childViews.length ? childViews[start] : null);
}
// if there is an element after the ones we deleted
if (start<childViews.length) {
childViews[start].set('prevView', start>0 ? childViews[start-1] : null);
}
}, },
/** /**
@ -14609,11 +14655,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
contentIndex: idx contentIndex: idx
}); });
// link together the chain of addedViews
if (addedViews.length>0) {
view.set('prevView', addedViews[addedViews.length-1]);
addedViews[addedViews.length-1].set('nextView', view);
}
addedViews.push(view); addedViews.push(view);
} }
} else { } else {
@ -14624,20 +14665,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
addedViews.push(emptyView); addedViews.push(emptyView);
set(this, 'emptyView', emptyView); set(this, 'emptyView', emptyView);
} }
if (added>0) {
// if there is a childview before the ones we're adding
if (start>0) {
childViews.objectAt(start-1).set('nextView', addedViews[0]);
addedViews[0].set('prevView', childViews.objectAt(start-1));
}
// if there is a childview after the ones we're adding
if (start<childViews.length) {
childViews.objectAt(start).set('prevView', addedViews[addedViews.length-1]);
addedViews[addedViews.length-1].set('nextView', childViews.objectAt(start));
}
}
childViews.replace(start, 0, addedViews); childViews.replace(start, 0, addedViews);
}, },
@ -15886,6 +15913,10 @@ var merge = function(original, hash) {
} }
}; };
/**
@class
@extends Ember.Mixin
*/
Ember.Routable = Ember.Mixin.create({ Ember.Routable = Ember.Mixin.create({
init: function() { init: function() {
var redirection; var redirection;
@ -16222,8 +16253,10 @@ Ember.Routable = Ember.Mixin.create({
state of the state it will eventually move into. state of the state it will eventually move into.
*/ */
unroutePath: function(router, path) { unroutePath: function(router, path) {
var parentState = get(this, 'parentState');
// If we're at the root state, we're done // If we're at the root state, we're done
if (get(this, 'parentState') === router) { if (parentState === router) {
return; return;
} }
@ -16246,8 +16279,12 @@ Ember.Routable = Ember.Mixin.create({
} }
// Transition to the parent and call unroute again. // Transition to the parent and call unroute again.
var parentPath = get(get(this, 'parentState'), 'path'); router.enterState({
router.transitionTo(parentPath); exitStates: [this],
enterStates: [],
finalState: parentState
});
router.send('unroutePath', path); router.send('unroutePath', path);
}, },
@ -16272,6 +16309,7 @@ Ember.Routable = Ember.Mixin.create({
(function() { (function() {
/** /**
@class @class
@extends Ember.Routable
*/ */
Ember.Route = Ember.State.extend(Ember.Routable); Ember.Route = Ember.State.extend(Ember.Routable);
@ -16344,6 +16382,15 @@ Ember._RouteMatcher = Ember.Object.extend({
(function() { (function() {
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
var merge = function(original, hash) {
for (var prop in hash) {
if (!hash.hasOwnProperty(prop)) { continue; }
if (original.hasOwnProperty(prop)) { continue; }
original[prop] = hash[prop];
}
};
/** /**
@class @class
@ -16829,7 +16876,8 @@ Ember.Router = Ember.StateManager.extend(
return location.formatURL(absoluteRoute); return location.formatURL(absoluteRoute);
}, },
urlForEvent: function(eventName, context) { urlForEvent: function(eventName) {
var contexts = Array.prototype.slice.call(arguments, 1);
var currentState = get(this, 'currentState'); var currentState = get(this, 'currentState');
var targetStateName = currentState.lookupEventTransition(eventName); var targetStateName = currentState.lookupEventTransition(eventName);
@ -16839,17 +16887,19 @@ Ember.Router = Ember.StateManager.extend(
Ember.assert("Your target state name " + targetStateName + " for event " + eventName + " did not resolve to a state", !!targetState); Ember.assert("Your target state name " + targetStateName + " for event " + eventName + " did not resolve to a state", !!targetState);
var hash = this.serializeRecursively(targetState, context); var hash = this.serializeRecursively(targetState, contexts, {});
return this.urlFor(targetStateName, hash); return this.urlFor(targetStateName, hash);
}, },
/** @private */ /** @private */
serializeRecursively: function(state, hash) { serializeRecursively: function(state, contexts, hash) {
hash = state.serialize(this, hash); var parentState,
var parentState = state.get("parentState"); context = get(state, 'hasContext') ? contexts.pop() : null;
merge(hash, state.serialize(this, context));
parentState = state.get("parentState");
if (parentState && parentState instanceof Ember.Route) { if (parentState && parentState instanceof Ember.Route) {
return this.serializeRecursively(parentState, hash); return this.serializeRecursively(parentState, contexts, hash);
} else { } else {
return hash; return hash;
} }
@ -16968,6 +17018,7 @@ Ember.StateManager.reopen(
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class @class
@deprecated
Ember.ViewState extends Ember.State to control the presence of a childView within a Ember.ViewState extends Ember.State to control the presence of a childView within a
container based on the current state of the ViewState's StateManager. container based on the current state of the ViewState's StateManager.
@ -17717,11 +17768,13 @@ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
/** /**
Override the the opcode compiler and JavaScript compiler for Handlebars. Override the the opcode compiler and JavaScript compiler for Handlebars.
@private
*/ */
Ember.Handlebars.Compiler = function() {}; Ember.Handlebars.Compiler = function() {};
Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype); Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler; Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
/** @private */
Ember.Handlebars.JavaScriptCompiler = function() {}; Ember.Handlebars.JavaScriptCompiler = function() {};
Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype); Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler; Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
@ -17944,25 +17997,11 @@ var DOMManager = {
}); });
}, },
after: function(parentView, view, newView) { after: function(view, nextView) {
newView._insertElementLater(function() { nextView._insertElementLater(function() {
var morph; var morph = view.morph;
var nextView; morph.after(nextView.outerHTML);
var prevView = view; nextView.outerHTML = null;
// Find a previous item that actually exists in the page
while (prevView !== null && prevView.get('state') === 'destroyed') {
prevView=prevView.get('prevView');
}
if (prevView === null) {
morph = parentView.get('morph');
morph.prepend(newView.outerHTML);
newView.outerHTML = null;
} else {
morph = prevView.morph;
morph.after(newView.outerHTML);
newView.outerHTML = null;
}
}); });
}, },
@ -18518,7 +18557,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
// to which we were bound has been removed from the view. // to which we were bound has been removed from the view.
// In that case, we can assume the template has been re-rendered // In that case, we can assume the template has been re-rendered
// and we need to clean up the observer. // and we need to clean up the observer.
if (elem.length === 0) { if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker); Ember.removeObserver(pathRoot, path, invoker);
return; return;
} }
@ -18633,7 +18672,7 @@ EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId,
// If we can't find the element anymore, a parent template has been // If we can't find the element anymore, a parent template has been
// re-rendered and we've been nuked. Remove the observer. // re-rendered and we've been nuked. Remove the observer.
if (elem.length === 0) { if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker); Ember.removeObserver(pathRoot, path, invoker);
} else { } else {
// If we had previously added a class to the element, remove it. // If we had previously added a class to the element, remove it.
@ -19405,6 +19444,10 @@ ActionHelper.registerAction = function(actionName, options) {
event.context = options.context; event.context = options.context;
} }
if (options.hasOwnProperty('contexts')) {
event.contexts = options.contexts;
}
var target = options.target; var target = options.target;
// Check for StateManager (or compatible object) // Check for StateManager (or compatible object)
@ -19590,7 +19633,7 @@ EmberHandlebars.registerHelper('action', function(actionName) {
var hash = options.hash, var hash = options.hash,
view = options.data.view, view = options.data.view,
target, context, controller, link; target, controller, link;
// create a hash to pass along to registerAction // create a hash to pass along to registerAction
var action = { var action = {
@ -19607,15 +19650,17 @@ EmberHandlebars.registerHelper('action', function(actionName) {
action.target = target = target || view; action.target = target = target || view;
// TODO: Support multiple contexts
if (contexts.length) { if (contexts.length) {
action.context = context = getPath(this, contexts[0], options); action.contexts = contexts = Ember.EnumerableUtils.map(contexts, function(context) {
return getPath(this, context, options);
}, this);
action.context = contexts[0];
} }
var output = [], url; var output = [], url;
if (hash.href && target.urlForEvent) { if (hash.href && target.urlForEvent) {
url = target.urlForEvent(actionName, context); url = target.urlForEvent.apply(target, [actionName].concat(contexts));
output.push('href="' + url + '"'); output.push('href="' + url + '"');
action.link = true; action.link = true;
} }
@ -19796,6 +19841,7 @@ var set = Ember.set, get = Ember.get;
Because HTML `input` elements are self closing `layout` and `layoutName` properties will Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information. not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
*/ */
Ember.Checkbox = Ember.View.extend({ Ember.Checkbox = Ember.View.extend({
classNames: ['ember-checkbox'], classNames: ['ember-checkbox'],
@ -19847,6 +19893,7 @@ Ember.TextSupport = Ember.Mixin.create(
insertNewline: Ember.K, insertNewline: Ember.K,
cancel: Ember.K, cancel: Ember.K,
/** @private */
init: function() { init: function() {
this._super(); this._super();
this.on("focusOut", this, this._elementValueDidChange); this.on("focusOut", this, this._elementValueDidChange);
@ -19904,6 +19951,7 @@ var get = Ember.get, set = Ember.set;
Because HTML `input` elements are self closing `layout` and `layoutName` properties will Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information. not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport @extends Ember.TextSupport
*/ */
Ember.TextField = Ember.View.extend(Ember.TextSupport, Ember.TextField = Ember.View.extend(Ember.TextSupport,
@ -20083,6 +20131,7 @@ var get = Ember.get, set = Ember.set;
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName` Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
properties will not be applied. See `Ember.View`'s layout section for more information. properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport @extends Ember.TextSupport
*/ */
Ember.TextArea = Ember.View.extend(Ember.TextSupport, Ember.TextArea = Ember.View.extend(Ember.TextSupport,
@ -20097,12 +20146,14 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
_updateElementValue: Ember.observer(function() { _updateElementValue: Ember.observer(function() {
// We do this check so cursor position doesn't get affected in IE // We do this check so cursor position doesn't get affected in IE
var value = get(this, 'value'); var value = get(this, 'value'),
if (value !== this.$().val()) { $el = this.$();
this.$().val(value); if ($el && value !== $el.val()) {
$el.val(value);
} }
}, 'value'), }, 'value'),
/** @private */
init: function() { init: function() {
this._super(); this._super();
this.on("didInsertElement", this, this._updateElementValue); this.on("didInsertElement", this, this._updateElementValue);
@ -20434,8 +20485,10 @@ Ember.Select = Ember.View.extend(
}, },
_selectionDidChangeSingle: function() { _selectionDidChangeSingle: function() {
var el = this.$()[0], var el = this.get('element');
content = get(this, 'content'), if (!el) { return; }
var content = get(this, 'content'),
selection = get(this, 'selection'), selection = get(this, 'selection'),
selectionIndex = content ? indexOf(content, selection) : -1, selectionIndex = content ? indexOf(content, selection) : -1,
prompt = get(this, 'prompt'); prompt = get(this, 'prompt');
@ -20609,6 +20662,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
}); });
}; };
/** @private */
function bootstrap() { function bootstrap() {
Ember.Handlebars.bootstrap( Ember.$(document) ); Ember.Handlebars.bootstrap( Ember.$(document) );
} }
@ -20640,8 +20694,8 @@ Ember.onLoad('application', bootstrap);
})(); })();
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre-5-gf1ec52a
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() { (function() {

File diff suppressed because one or more lines are too long

View File

@ -1952,8 +1952,8 @@ Handlebars.VM = {
Handlebars.template = Handlebars.VM.template; Handlebars.template = Handlebars.VM.template;
; ;
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
(function() { (function() {
@ -2096,8 +2096,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})(); })();
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre-5-gf1ec52a
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() { (function() {
@ -2965,6 +2965,8 @@ function canInvoke(obj, methodName) {
/** /**
Checks to see if the `methodName` exists on the `obj`. Checks to see if the `methodName` exists on the `obj`.
@function
@param {Object} obj The object to check for the method @param {Object} obj The object to check for the method
@param {String} methodName The method name to check for @param {String} methodName The method name to check for
*/ */
@ -3654,8 +3656,22 @@ var Descriptor = Ember.Descriptor = function() {};
return this.firstName+' '+this.lastName; return this.firstName+' '+this.lastName;
}).property('firstName', 'lastName').cacheable()); }).property('firstName', 'lastName').cacheable());
*/ */
Ember.defineProperty = function(obj, keyName, desc, val, meta) { Ember.defineProperty = function(obj, keyName, desc, data, meta) {
var descs, existingDesc, watching; // The first two parameters to defineProperty are mandatory:
//
// * obj: the object to define this property on. This may be
// a prototype.
// * keyName: the name of the property
//
// One and only one of the following two parameters must be
// provided:
//
// * desc: an instance of Ember.Descriptor (typically a
// computed property) or an ES5 descriptor.
// * data: something other than a descriptor, that will
// become the explicit value of this property.
var descs, existingDesc, watching, value;
if (!meta) meta = metaFor(obj); if (!meta) meta = metaFor(obj);
descs = meta.descs; descs = meta.descs;
@ -3667,6 +3683,8 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} }
if (desc instanceof Ember.Descriptor) { if (desc instanceof Ember.Descriptor) {
value = desc;
descs[keyName] = desc; descs[keyName] = desc;
if (MANDATORY_SETTER && watching) { if (MANDATORY_SETTER && watching) {
objectDefineProperty(obj, keyName, { objectDefineProperty(obj, keyName, {
@ -3682,8 +3700,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} else { } else {
descs[keyName] = undefined; // shadow descriptor in proto descs[keyName] = undefined; // shadow descriptor in proto
if (desc == null) { if (desc == null) {
value = data;
if (MANDATORY_SETTER && watching) { if (MANDATORY_SETTER && watching) {
meta.values[keyName] = val; meta.values[keyName] = data;
objectDefineProperty(obj, keyName, { objectDefineProperty(obj, keyName, {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
@ -3696,9 +3716,11 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} }
}); });
} else { } else {
obj[keyName] = val; obj[keyName] = data;
} }
} else { } else {
value = desc;
// compatibility with ES5 // compatibility with ES5
objectDefineProperty(obj, keyName, desc); objectDefineProperty(obj, keyName, desc);
} }
@ -3708,6 +3730,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
// were initialized with the prototype // were initialized with the prototype
if (watching) { Ember.overrideChains(obj, keyName, meta); } if (watching) { Ember.overrideChains(obj, keyName, meta); }
// The `value` passed to the `didDefineProperty` hook is
// either the descriptor or data, whichever was passed.
if (obj.didDefineProperty) { obj.didDefineProperty(obj, keyName, value); }
return this; return this;
}; };
@ -4056,8 +4082,6 @@ function flushPendingChains() {
forEach.call(queue, function(q) { q[0].add(q[1]); }); forEach.call(queue, function(q) { q[0].add(q[1]); });
Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0); Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0);
if(pendingQueue.length > 0)
console.log(pendingQueue)
} }
/** @private */ /** @private */
@ -4743,7 +4767,9 @@ var ComputedPropertyPrototype = ComputedProperty.prototype;
Properties are cacheable by default. Properties are cacheable by default.
@name Ember.ComputedProperty.cacheable @memberOf Ember.ComputedProperty.prototype
@name cacheable
@function
@param {Boolean} aFlag optional set to false to disable caching @param {Boolean} aFlag optional set to false to disable caching
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
@ -4762,7 +4788,9 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
}.property().volatile() }.property().volatile()
}); });
@name Ember.ComputedProperty.volatile @memberOf Ember.ComputedProperty.prototype
@name volatile
@function
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
ComputedPropertyPrototype.volatile = function() { ComputedPropertyPrototype.volatile = function() {
@ -4782,7 +4810,9 @@ ComputedPropertyPrototype.volatile = function() {
}).property('firstName', 'lastName') }).property('firstName', 'lastName')
}); });
@name Ember.ComputedProperty.property @memberOf Ember.ComputedProperty.prototype
@name property
@function
@param {String} path... zero or more property paths @param {String} path... zero or more property paths
@returns {Ember.ComputedProperty} receiver @returns {Ember.ComputedProperty} receiver
*/ */
@ -4813,14 +4843,20 @@ ComputedPropertyPrototype.property = function() {
exposes a public API for retrieving these values from classes, exposes a public API for retrieving these values from classes,
via the `metaForProperty()` function. via the `metaForProperty()` function.
@name Ember.ComputedProperty.meta @memberOf Ember.ComputedProperty.prototype
@param {Hash} metadata @name meta
@function
@param {Hash} meta
@returns {Ember.ComputedProperty} property descriptor instance @returns {Ember.ComputedProperty} property descriptor instance
*/ */
ComputedPropertyPrototype.meta = function(meta) { ComputedPropertyPrototype.meta = function(meta) {
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta; this._meta = meta;
return this; return this;
}
}; };
/** @private - impl descriptor API */ /** @private - impl descriptor API */
@ -6868,6 +6904,17 @@ Ember.observer = function(func) {
return func; return func;
}; };
// If observers ever become asynchronous, Ember.immediateObserver
// must remain synchronous.
Ember.immediateObserver = function() {
for (var i=0, l=arguments.length; i<l; i++) {
var arg = arguments[i];
Ember.assert("Immediate observers must observe internal properties only, not properties on other objects.", typeof arg !== "string" || arg.indexOf('.') === -1);
}
return Ember.observer.apply(this, arguments);
};
Ember.beforeObserver = function(func) { Ember.beforeObserver = function(func) {
var paths = a_slice.call(arguments, 1); var paths = a_slice.call(arguments, 1);
func.__ember_observesBefore__ = paths; func.__ember_observesBefore__ = paths;
@ -8966,6 +9013,7 @@ Ember.Copyable = Ember.Mixin.create(
Override to return a copy of the receiver. Default implementation raises Override to return a copy of the receiver. Default implementation raises
an exception. an exception.
@function
@param deep {Boolean} if true, a deep copy of the object should be made @param deep {Boolean} if true, a deep copy of the object should be made
@returns {Object} copy of receiver @returns {Object} copy of receiver
*/ */
@ -9162,6 +9210,8 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
If the passed object is of a type not supported by the receiver If the passed object is of a type not supported by the receiver
then this method should raise an exception. then this method should raise an exception.
@function
@param {Object} object @param {Object} object
The object to add to the enumerable. The object to add to the enumerable.
@ -9192,6 +9242,8 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
If the passed object is of a type not supported by the receiver If the passed object is of a type not supported by the receiver
then this method should raise an exception. then this method should raise an exception.
@function
@param {Object} object @param {Object} object
The object to remove from the enumerable. The object to remove from the enumerable.
@ -9262,6 +9314,8 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
should replace amt objects started at idx with the objects in the passed should replace amt objects started at idx with the objects in the passed
array. You should also call this.enumerableContentDidChange() ; array. You should also call this.enumerableContentDidChange() ;
@function
@param {Number} idx @param {Number} idx
Starting index in the array to replace. If idx >= length, then append Starting index in the array to replace. If idx >= length, then append
to the end of the array. to the end of the array.
@ -12270,6 +12324,8 @@ var get = Ember.get, set = Ember.set;
perhaps be moved so that it's visible in the JsDoc output. perhaps be moved so that it's visible in the JsDoc output.
*/ */
/** /**
@class
Ember.Location returns an instance of the correct implementation of Ember.Location returns an instance of the correct implementation of
the `location` API. the `location` API.
@ -12302,11 +12358,18 @@ Ember.Location = {
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.HashLocation implements the location API using the browser's Ember.HashLocation implements the location API using the browser's
hash. At present, it relies on a hashchange event existing in the hash. At present, it relies on a hashchange event existing in the
browser. browser.
@extends Ember.Object
*/ */
Ember.HashLocation = Ember.Object.extend({ Ember.HashLocation = Ember.Object.extend(
/** @scope Ember.HashLocation.prototype */ {
/** @private */
init: function() { init: function() {
set(this, 'location', get(this, 'location') || window.location); set(this, 'location', get(this, 'location') || window.location);
}, },
@ -12366,6 +12429,7 @@ Ember.HashLocation = Ember.Object.extend({
return '#'+url; return '#'+url;
}, },
/** @private */
willDestroy: function() { willDestroy: function() {
var guid = Ember.guidFor(this); var guid = Ember.guidFor(this);
@ -12383,10 +12447,17 @@ Ember.Location.registerImplementation('hash', Ember.HashLocation);
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.HistoryLocation implements the location API using the browser's Ember.HistoryLocation implements the location API using the browser's
history.pushState API. history.pushState API.
@extends Ember.Object
*/ */
Ember.HistoryLocation = Ember.Object.extend({ Ember.HistoryLocation = Ember.Object.extend(
/** @scope Ember.HistoryLocation.prototype */ {
/** @private */
init: function() { init: function() {
set(this, 'location', get(this, 'location') || window.location); set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname); set(this, '_initialURL', get(this, 'location').pathname);
@ -12424,8 +12495,7 @@ Ember.HistoryLocation = Ember.Object.extend({
path = this.formatPath(path); path = this.formatPath(path);
if ((initialURL && initialURL !== path) || (state && state.path !== path)) { if ((initialURL !== path && !state) || (state && state.path !== path)) {
set(this, '_initialURL', null);
window.history.pushState({ path: path }, null, path); window.history.pushState({ path: path }, null, path);
} }
}, },
@ -12469,6 +12539,7 @@ Ember.HistoryLocation = Ember.Object.extend({
return url; return url;
}, },
/** @private */
willDestroy: function() { willDestroy: function() {
var guid = Ember.guidFor(this); var guid = Ember.guidFor(this);
@ -12486,12 +12557,17 @@ Ember.Location.registerImplementation('history', Ember.HistoryLocation);
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class
Ember.NoneLocation does not interact with the browser. It is useful for Ember.NoneLocation does not interact with the browser. It is useful for
testing, or when you need to manage state with your Router, but temporarily testing, or when you need to manage state with your Router, but temporarily
don't want it to muck with the URL (for example when you embed your don't want it to muck with the URL (for example when you embed your
application in a larger page). application in a larger page).
@extends Ember.Object
*/ */
Ember.NoneLocation = Ember.Object.extend({ Ember.NoneLocation = Ember.Object.extend(
/** @scope Ember.NoneLocation.prototype */ {
path: '', path: '',
getURL: function() { getURL: function() {
@ -14046,10 +14122,6 @@ Ember.View = Ember.Object.extend(Ember.Evented,
_parentView: null, _parentView: null,
// allow navigation between the next and previous views
prevView: null,
nextView: null,
// return the current view, not including virtual views // return the current view, not including virtual views
concreteView: Ember.computed(function() { concreteView: Ember.computed(function() {
if (!this.isVirtual) { return this; } if (!this.isVirtual) { return this; }
@ -14415,6 +14487,8 @@ Ember.View = Ember.Object.extend(Ember.Evented,
// JavaScript property changes. // JavaScript property changes.
var observer = function() { var observer = function() {
elem = this.$(); elem = this.$();
if (!elem) { return; }
attributeValue = get(this, property); attributeValue = get(this, property);
Ember.View.applyAttributeBindings(elem, attributeName, attributeValue); Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);
@ -15226,9 +15300,12 @@ Ember.View = Ember.Object.extend(Ember.Evented,
element of the actual DOM element. element of the actual DOM element.
*/ */
_isVisibleDidChange: Ember.observer(function() { _isVisibleDidChange: Ember.observer(function() {
var $el = this.$();
if (!$el) { return; }
var isVisible = get(this, 'isVisible'); var isVisible = get(this, 'isVisible');
this.$().toggle(isVisible); $el.toggle(isVisible);
if (this._isAncestorHidden()) { return; } if (this._isAncestorHidden()) { return; }
@ -15361,22 +15438,10 @@ var DOMManager = {
}); });
}, },
after: function(parentView, view, newView) { after: function(view, nextView) {
newView._insertElementLater(function() { nextView._insertElementLater(function() {
var nextView; var element = view.$();
var prevView = view; element.after(nextView.$());
while (prevView !== null && prevView.get('state') !== 'inDOM') {
prevView=prevView.get('prevView');
}
var element;
if (prevView === null) {
element = parentView.$();
element.prepend(newView.$());
} else {
element = prevView.$();
element.after(newView.$());
}
}); });
}, },
@ -15544,7 +15609,7 @@ Ember.View.states = {
}, },
$: function() { $: function() {
return Ember.$(); return undefined;
}, },
getElement: function() { getElement: function() {
@ -15649,13 +15714,7 @@ Ember.View.states.inBuffer = {
var buffer = view.buffer; var buffer = view.buffer;
childView = this.createChildView(childView, options); childView = this.createChildView(childView, options);
var childViews = get(view, '_childViews'); view._childViews.push(childView);
if (childViews.length > 0) {
childViews[childViews.length-1].nextView = childView;
childView.prevView = childViews[childViews.length-1];
}
childViews.push(childView);
childView.renderToBuffer(buffer); childView.renderToBuffer(buffer);
@ -16074,10 +16133,6 @@ Ember.ContainerView = Ember.View.extend({
view = this.createChildView(viewName); view = this.createChildView(viewName);
} }
if (idx>0) {
_childViews[idx-1].nextView = view;
view.prevView = _childViews[idx-1];
}
_childViews[idx] = view; _childViews[idx] = view;
}, this); }, this);
@ -16193,7 +16248,7 @@ Ember.ContainerView = Ember.View.extend({
*/ */
_scheduleInsertion: function(view, prev) { _scheduleInsertion: function(view, prev) {
if (prev) { if (prev) {
prev.domManager.after(this, prev, view); prev.domManager.after(prev, view);
} else { } else {
this.domManager.prepend(this, view); this.domManager.prepend(this, view);
} }
@ -16514,15 +16569,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
if (removingAll) { childView.removedFromDOM = true; } if (removingAll) { childView.removedFromDOM = true; }
childView.destroy(); childView.destroy();
} }
// If there is an element before the ones we deleted
if (start>0) {
childViews[start-1].set('nextView', start<childViews.length ? childViews[start] : null);
}
// if there is an element after the ones we deleted
if (start<childViews.length) {
childViews[start].set('prevView', start>0 ? childViews[start-1] : null);
}
}, },
/** /**
@ -16563,11 +16609,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
contentIndex: idx contentIndex: idx
}); });
// link together the chain of addedViews
if (addedViews.length>0) {
view.set('prevView', addedViews[addedViews.length-1]);
addedViews[addedViews.length-1].set('nextView', view);
}
addedViews.push(view); addedViews.push(view);
} }
} else { } else {
@ -16578,20 +16619,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
addedViews.push(emptyView); addedViews.push(emptyView);
set(this, 'emptyView', emptyView); set(this, 'emptyView', emptyView);
} }
if (added>0) {
// if there is a childview before the ones we're adding
if (start>0) {
childViews.objectAt(start-1).set('nextView', addedViews[0]);
addedViews[0].set('prevView', childViews.objectAt(start-1));
}
// if there is a childview after the ones we're adding
if (start<childViews.length) {
childViews.objectAt(start).set('prevView', addedViews[addedViews.length-1]);
addedViews[addedViews.length-1].set('nextView', childViews.objectAt(start));
}
}
childViews.replace(start, 0, addedViews); childViews.replace(start, 0, addedViews);
}, },
@ -17840,6 +17867,10 @@ var merge = function(original, hash) {
} }
}; };
/**
@class
@extends Ember.Mixin
*/
Ember.Routable = Ember.Mixin.create({ Ember.Routable = Ember.Mixin.create({
init: function() { init: function() {
var redirection; var redirection;
@ -18176,8 +18207,10 @@ Ember.Routable = Ember.Mixin.create({
state of the state it will eventually move into. state of the state it will eventually move into.
*/ */
unroutePath: function(router, path) { unroutePath: function(router, path) {
var parentState = get(this, 'parentState');
// If we're at the root state, we're done // If we're at the root state, we're done
if (get(this, 'parentState') === router) { if (parentState === router) {
return; return;
} }
@ -18200,8 +18233,12 @@ Ember.Routable = Ember.Mixin.create({
} }
// Transition to the parent and call unroute again. // Transition to the parent and call unroute again.
var parentPath = get(get(this, 'parentState'), 'path'); router.enterState({
router.transitionTo(parentPath); exitStates: [this],
enterStates: [],
finalState: parentState
});
router.send('unroutePath', path); router.send('unroutePath', path);
}, },
@ -18226,6 +18263,7 @@ Ember.Routable = Ember.Mixin.create({
(function() { (function() {
/** /**
@class @class
@extends Ember.Routable
*/ */
Ember.Route = Ember.State.extend(Ember.Routable); Ember.Route = Ember.State.extend(Ember.Routable);
@ -18298,6 +18336,15 @@ Ember._RouteMatcher = Ember.Object.extend({
(function() { (function() {
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
var merge = function(original, hash) {
for (var prop in hash) {
if (!hash.hasOwnProperty(prop)) { continue; }
if (original.hasOwnProperty(prop)) { continue; }
original[prop] = hash[prop];
}
};
/** /**
@class @class
@ -18783,7 +18830,8 @@ Ember.Router = Ember.StateManager.extend(
return location.formatURL(absoluteRoute); return location.formatURL(absoluteRoute);
}, },
urlForEvent: function(eventName, context) { urlForEvent: function(eventName) {
var contexts = Array.prototype.slice.call(arguments, 1);
var currentState = get(this, 'currentState'); var currentState = get(this, 'currentState');
var targetStateName = currentState.lookupEventTransition(eventName); var targetStateName = currentState.lookupEventTransition(eventName);
@ -18793,17 +18841,19 @@ Ember.Router = Ember.StateManager.extend(
Ember.assert("Your target state name " + targetStateName + " for event " + eventName + " did not resolve to a state", !!targetState); Ember.assert("Your target state name " + targetStateName + " for event " + eventName + " did not resolve to a state", !!targetState);
var hash = this.serializeRecursively(targetState, context); var hash = this.serializeRecursively(targetState, contexts, {});
return this.urlFor(targetStateName, hash); return this.urlFor(targetStateName, hash);
}, },
/** @private */ /** @private */
serializeRecursively: function(state, hash) { serializeRecursively: function(state, contexts, hash) {
hash = state.serialize(this, hash); var parentState,
var parentState = state.get("parentState"); context = get(state, 'hasContext') ? contexts.pop() : null;
merge(hash, state.serialize(this, context));
parentState = state.get("parentState");
if (parentState && parentState instanceof Ember.Route) { if (parentState && parentState instanceof Ember.Route) {
return this.serializeRecursively(parentState, hash); return this.serializeRecursively(parentState, contexts, hash);
} else { } else {
return hash; return hash;
} }
@ -18922,6 +18972,7 @@ Ember.StateManager.reopen(
var get = Ember.get, set = Ember.set; var get = Ember.get, set = Ember.set;
/** /**
@class @class
@deprecated
Ember.ViewState extends Ember.State to control the presence of a childView within a Ember.ViewState extends Ember.State to control the presence of a childView within a
container based on the current state of the ViewState's StateManager. container based on the current state of the ViewState's StateManager.
@ -19671,11 +19722,13 @@ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
/** /**
Override the the opcode compiler and JavaScript compiler for Handlebars. Override the the opcode compiler and JavaScript compiler for Handlebars.
@private
*/ */
Ember.Handlebars.Compiler = function() {}; Ember.Handlebars.Compiler = function() {};
Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype); Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler; Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
/** @private */
Ember.Handlebars.JavaScriptCompiler = function() {}; Ember.Handlebars.JavaScriptCompiler = function() {};
Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype); Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler; Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
@ -19898,25 +19951,11 @@ var DOMManager = {
}); });
}, },
after: function(parentView, view, newView) { after: function(view, nextView) {
newView._insertElementLater(function() { nextView._insertElementLater(function() {
var morph; var morph = view.morph;
var nextView; morph.after(nextView.outerHTML);
var prevView = view; nextView.outerHTML = null;
// Find a previous item that actually exists in the page
while (prevView !== null && prevView.get('state') === 'destroyed') {
prevView=prevView.get('prevView');
}
if (prevView === null) {
morph = parentView.get('morph');
morph.prepend(newView.outerHTML);
newView.outerHTML = null;
} else {
morph = prevView.morph;
morph.after(newView.outerHTML);
newView.outerHTML = null;
}
}); });
}, },
@ -20472,7 +20511,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
// to which we were bound has been removed from the view. // to which we were bound has been removed from the view.
// In that case, we can assume the template has been re-rendered // In that case, we can assume the template has been re-rendered
// and we need to clean up the observer. // and we need to clean up the observer.
if (elem.length === 0) { if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker); Ember.removeObserver(pathRoot, path, invoker);
return; return;
} }
@ -20587,7 +20626,7 @@ EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId,
// If we can't find the element anymore, a parent template has been // If we can't find the element anymore, a parent template has been
// re-rendered and we've been nuked. Remove the observer. // re-rendered and we've been nuked. Remove the observer.
if (elem.length === 0) { if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker); Ember.removeObserver(pathRoot, path, invoker);
} else { } else {
// If we had previously added a class to the element, remove it. // If we had previously added a class to the element, remove it.
@ -21359,6 +21398,10 @@ ActionHelper.registerAction = function(actionName, options) {
event.context = options.context; event.context = options.context;
} }
if (options.hasOwnProperty('contexts')) {
event.contexts = options.contexts;
}
var target = options.target; var target = options.target;
// Check for StateManager (or compatible object) // Check for StateManager (or compatible object)
@ -21544,7 +21587,7 @@ EmberHandlebars.registerHelper('action', function(actionName) {
var hash = options.hash, var hash = options.hash,
view = options.data.view, view = options.data.view,
target, context, controller, link; target, controller, link;
// create a hash to pass along to registerAction // create a hash to pass along to registerAction
var action = { var action = {
@ -21561,15 +21604,17 @@ EmberHandlebars.registerHelper('action', function(actionName) {
action.target = target = target || view; action.target = target = target || view;
// TODO: Support multiple contexts
if (contexts.length) { if (contexts.length) {
action.context = context = getPath(this, contexts[0], options); action.contexts = contexts = Ember.EnumerableUtils.map(contexts, function(context) {
return getPath(this, context, options);
}, this);
action.context = contexts[0];
} }
var output = [], url; var output = [], url;
if (hash.href && target.urlForEvent) { if (hash.href && target.urlForEvent) {
url = target.urlForEvent(actionName, context); url = target.urlForEvent.apply(target, [actionName].concat(contexts));
output.push('href="' + url + '"'); output.push('href="' + url + '"');
action.link = true; action.link = true;
} }
@ -21750,6 +21795,7 @@ var set = Ember.set, get = Ember.get;
Because HTML `input` elements are self closing `layout` and `layoutName` properties will Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information. not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
*/ */
Ember.Checkbox = Ember.View.extend({ Ember.Checkbox = Ember.View.extend({
classNames: ['ember-checkbox'], classNames: ['ember-checkbox'],
@ -21801,6 +21847,7 @@ Ember.TextSupport = Ember.Mixin.create(
insertNewline: Ember.K, insertNewline: Ember.K,
cancel: Ember.K, cancel: Ember.K,
/** @private */
init: function() { init: function() {
this._super(); this._super();
this.on("focusOut", this, this._elementValueDidChange); this.on("focusOut", this, this._elementValueDidChange);
@ -21858,6 +21905,7 @@ var get = Ember.get, set = Ember.set;
Because HTML `input` elements are self closing `layout` and `layoutName` properties will Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information. not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport @extends Ember.TextSupport
*/ */
Ember.TextField = Ember.View.extend(Ember.TextSupport, Ember.TextField = Ember.View.extend(Ember.TextSupport,
@ -22037,6 +22085,7 @@ var get = Ember.get, set = Ember.set;
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName` Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
properties will not be applied. See `Ember.View`'s layout section for more information. properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport @extends Ember.TextSupport
*/ */
Ember.TextArea = Ember.View.extend(Ember.TextSupport, Ember.TextArea = Ember.View.extend(Ember.TextSupport,
@ -22051,12 +22100,14 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
_updateElementValue: Ember.observer(function() { _updateElementValue: Ember.observer(function() {
// We do this check so cursor position doesn't get affected in IE // We do this check so cursor position doesn't get affected in IE
var value = get(this, 'value'); var value = get(this, 'value'),
if (value !== this.$().val()) { $el = this.$();
this.$().val(value); if ($el && value !== $el.val()) {
$el.val(value);
} }
}, 'value'), }, 'value'),
/** @private */
init: function() { init: function() {
this._super(); this._super();
this.on("didInsertElement", this, this._updateElementValue); this.on("didInsertElement", this, this._updateElementValue);
@ -22388,8 +22439,10 @@ Ember.Select = Ember.View.extend(
}, },
_selectionDidChangeSingle: function() { _selectionDidChangeSingle: function() {
var el = this.$()[0], var el = this.get('element');
content = get(this, 'content'), if (!el) { return; }
var content = get(this, 'content'),
selection = get(this, 'selection'), selection = get(this, 'selection'),
selectionIndex = content ? indexOf(content, selection) : -1, selectionIndex = content ? indexOf(content, selection) : -1,
prompt = get(this, 'prompt'); prompt = get(this, 'prompt');
@ -22563,6 +22616,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
}); });
}; };
/** @private */
function bootstrap() { function bootstrap() {
Ember.Handlebars.bootstrap( Ember.$(document) ); Ember.Handlebars.bootstrap( Ember.$(document) );
} }
@ -22594,8 +22648,8 @@ Ember.onLoad('application', bootstrap);
})(); })();
// Version: v0.9.8.1-675-g417213d // Version: v1.0.pre-5-gf1ec52a
// Last commit: 417213d (2012-07-30 13:06:36 +0200) // Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() { (function() {