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
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre
// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
(function() {
@ -142,8 +142,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})();
// Version: v0.9.8.1-675-g417213d
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre-5-gf1ec52a
// Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() {
@ -1011,6 +1011,8 @@ function canInvoke(obj, methodName) {
/**
Checks to see if the `methodName` exists on the `obj`.
@function
@param {Object} obj The object to check for the method
@param {String} methodName The method name to check for
*/
@ -1700,8 +1702,22 @@ var Descriptor = Ember.Descriptor = function() {};
return this.firstName+' '+this.lastName;
}).property('firstName', 'lastName').cacheable());
*/
Ember.defineProperty = function(obj, keyName, desc, val, meta) {
var descs, existingDesc, watching;
Ember.defineProperty = function(obj, keyName, desc, data, meta) {
// 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);
descs = meta.descs;
@ -1713,6 +1729,8 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
}
if (desc instanceof Ember.Descriptor) {
value = desc;
descs[keyName] = desc;
if (MANDATORY_SETTER && watching) {
objectDefineProperty(obj, keyName, {
@ -1728,8 +1746,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} else {
descs[keyName] = undefined; // shadow descriptor in proto
if (desc == null) {
value = data;
if (MANDATORY_SETTER && watching) {
meta.values[keyName] = val;
meta.values[keyName] = data;
objectDefineProperty(obj, keyName, {
configurable: true,
enumerable: true,
@ -1742,9 +1762,11 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
}
});
} else {
obj[keyName] = val;
obj[keyName] = data;
}
} else {
value = desc;
// compatibility with ES5
objectDefineProperty(obj, keyName, desc);
}
@ -1754,6 +1776,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
// were initialized with the prototype
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;
};
@ -2102,8 +2128,6 @@ function flushPendingChains() {
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);
if(pendingQueue.length > 0)
console.log(pendingQueue)
}
/** @private */
@ -2789,7 +2813,9 @@ var ComputedPropertyPrototype = ComputedProperty.prototype;
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
@returns {Ember.ComputedProperty} receiver
*/
@ -2808,7 +2834,9 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
}.property().volatile()
});
@name Ember.ComputedProperty.volatile
@memberOf Ember.ComputedProperty.prototype
@name volatile
@function
@returns {Ember.ComputedProperty} receiver
*/
ComputedPropertyPrototype.volatile = function() {
@ -2828,7 +2856,9 @@ ComputedPropertyPrototype.volatile = function() {
}).property('firstName', 'lastName')
});
@name Ember.ComputedProperty.property
@memberOf Ember.ComputedProperty.prototype
@name property
@function
@param {String} path... zero or more property paths
@returns {Ember.ComputedProperty} receiver
*/
@ -2859,14 +2889,20 @@ ComputedPropertyPrototype.property = function() {
exposes a public API for retrieving these values from classes,
via the `metaForProperty()` function.
@name Ember.ComputedProperty.meta
@param {Hash} metadata
@memberOf Ember.ComputedProperty.prototype
@name meta
@function
@param {Hash} meta
@returns {Ember.ComputedProperty} property descriptor instance
*/
ComputedPropertyPrototype.meta = function(meta) {
this._meta = meta;
return this;
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta;
return this;
}
};
/** @private - impl descriptor API */
@ -4914,6 +4950,17 @@ Ember.observer = function(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) {
var paths = a_slice.call(arguments, 1);
func.__ember_observesBefore__ = paths;
@ -7012,6 +7059,7 @@ Ember.Copyable = Ember.Mixin.create(
Override to return a copy of the receiver. Default implementation raises
an exception.
@function
@param deep {Boolean} if true, a deep copy of the object should be made
@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
then this method should raise an exception.
@function
@param {Object} object
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
then this method should raise an exception.
@function
@param {Object} object
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
array. You should also call this.enumerableContentDidChange() ;
@function
@param {Number} idx
Starting index in the array to replace. If idx >= length, then append
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.
*/
/**
@class
Ember.Location returns an instance of the correct implementation of
the `location` API.
@ -10348,11 +10404,18 @@ Ember.Location = {
var get = Ember.get, set = Ember.set;
/**
@class
Ember.HashLocation implements the location API using the browser's
hash. At present, it relies on a hashchange event existing in the
browser.
@extends Ember.Object
*/
Ember.HashLocation = Ember.Object.extend({
Ember.HashLocation = Ember.Object.extend(
/** @scope Ember.HashLocation.prototype */ {
/** @private */
init: function() {
set(this, 'location', get(this, 'location') || window.location);
},
@ -10412,6 +10475,7 @@ Ember.HashLocation = Ember.Object.extend({
return '#'+url;
},
/** @private */
willDestroy: function() {
var guid = Ember.guidFor(this);
@ -10429,10 +10493,17 @@ Ember.Location.registerImplementation('hash', Ember.HashLocation);
var get = Ember.get, set = Ember.set;
/**
@class
Ember.HistoryLocation implements the location API using the browser's
history.pushState API.
@extends Ember.Object
*/
Ember.HistoryLocation = Ember.Object.extend({
Ember.HistoryLocation = Ember.Object.extend(
/** @scope Ember.HistoryLocation.prototype */ {
/** @private */
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname);
@ -10470,8 +10541,7 @@ Ember.HistoryLocation = Ember.Object.extend({
path = this.formatPath(path);
if ((initialURL && initialURL !== path) || (state && state.path !== path)) {
set(this, '_initialURL', null);
if ((initialURL !== path && !state) || (state && state.path !== path)) {
window.history.pushState({ path: path }, null, path);
}
},
@ -10515,6 +10585,7 @@ Ember.HistoryLocation = Ember.Object.extend({
return url;
},
/** @private */
willDestroy: function() {
var guid = Ember.guidFor(this);
@ -10532,12 +10603,17 @@ Ember.Location.registerImplementation('history', Ember.HistoryLocation);
var get = Ember.get, set = Ember.set;
/**
@class
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
don't want it to muck with the URL (for example when you embed your
application in a larger page).
@extends Ember.Object
*/
Ember.NoneLocation = Ember.Object.extend({
Ember.NoneLocation = Ember.Object.extend(
/** @scope Ember.NoneLocation.prototype */ {
path: '',
getURL: function() {
@ -12092,10 +12168,6 @@ Ember.View = Ember.Object.extend(Ember.Evented,
_parentView: null,
// allow navigation between the next and previous views
prevView: null,
nextView: null,
// return the current view, not including virtual views
concreteView: Ember.computed(function() {
if (!this.isVirtual) { return this; }
@ -12461,6 +12533,8 @@ Ember.View = Ember.Object.extend(Ember.Evented,
// JavaScript property changes.
var observer = function() {
elem = this.$();
if (!elem) { return; }
attributeValue = get(this, property);
Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);
@ -13272,9 +13346,12 @@ Ember.View = Ember.Object.extend(Ember.Evented,
element of the actual DOM element.
*/
_isVisibleDidChange: Ember.observer(function() {
var $el = this.$();
if (!$el) { return; }
var isVisible = get(this, 'isVisible');
this.$().toggle(isVisible);
$el.toggle(isVisible);
if (this._isAncestorHidden()) { return; }
@ -13407,22 +13484,10 @@ var DOMManager = {
});
},
after: function(parentView, view, newView) {
newView._insertElementLater(function() {
var nextView;
var prevView = view;
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.$());
}
after: function(view, nextView) {
nextView._insertElementLater(function() {
var element = view.$();
element.after(nextView.$());
});
},
@ -13590,7 +13655,7 @@ Ember.View.states = {
},
$: function() {
return Ember.$();
return undefined;
},
getElement: function() {
@ -13695,13 +13760,7 @@ Ember.View.states.inBuffer = {
var buffer = view.buffer;
childView = this.createChildView(childView, options);
var childViews = get(view, '_childViews');
if (childViews.length > 0) {
childViews[childViews.length-1].nextView = childView;
childView.prevView = childViews[childViews.length-1];
}
childViews.push(childView);
view._childViews.push(childView);
childView.renderToBuffer(buffer);
@ -14120,10 +14179,6 @@ Ember.ContainerView = Ember.View.extend({
view = this.createChildView(viewName);
}
if (idx>0) {
_childViews[idx-1].nextView = view;
view.prevView = _childViews[idx-1];
}
_childViews[idx] = view;
}, this);
@ -14239,7 +14294,7 @@ Ember.ContainerView = Ember.View.extend({
*/
_scheduleInsertion: function(view, prev) {
if (prev) {
prev.domManager.after(this, prev, view);
prev.domManager.after(prev, view);
} else {
this.domManager.prepend(this, view);
}
@ -14560,15 +14615,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
if (removingAll) { childView.removedFromDOM = true; }
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
});
// 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);
}
} else {
@ -14624,20 +14665,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
addedViews.push(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);
},
@ -15886,6 +15913,10 @@ var merge = function(original, hash) {
}
};
/**
@class
@extends Ember.Mixin
*/
Ember.Routable = Ember.Mixin.create({
init: function() {
var redirection;
@ -16222,8 +16253,10 @@ Ember.Routable = Ember.Mixin.create({
state of the state it will eventually move into.
*/
unroutePath: function(router, path) {
var parentState = get(this, 'parentState');
// If we're at the root state, we're done
if (get(this, 'parentState') === router) {
if (parentState === router) {
return;
}
@ -16246,8 +16279,12 @@ Ember.Routable = Ember.Mixin.create({
}
// Transition to the parent and call unroute again.
var parentPath = get(get(this, 'parentState'), 'path');
router.transitionTo(parentPath);
router.enterState({
exitStates: [this],
enterStates: [],
finalState: parentState
});
router.send('unroutePath', path);
},
@ -16272,6 +16309,7 @@ Ember.Routable = Ember.Mixin.create({
(function() {
/**
@class
@extends Ember.Routable
*/
Ember.Route = Ember.State.extend(Ember.Routable);
@ -16344,6 +16382,15 @@ Ember._RouteMatcher = Ember.Object.extend({
(function() {
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
@ -16829,7 +16876,8 @@ Ember.Router = Ember.StateManager.extend(
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 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);
var hash = this.serializeRecursively(targetState, context);
var hash = this.serializeRecursively(targetState, contexts, {});
return this.urlFor(targetStateName, hash);
},
/** @private */
serializeRecursively: function(state, hash) {
hash = state.serialize(this, hash);
var parentState = state.get("parentState");
serializeRecursively: function(state, contexts, hash) {
var parentState,
context = get(state, 'hasContext') ? contexts.pop() : null;
merge(hash, state.serialize(this, context));
parentState = state.get("parentState");
if (parentState && parentState instanceof Ember.Route) {
return this.serializeRecursively(parentState, hash);
return this.serializeRecursively(parentState, contexts, hash);
} else {
return hash;
}
@ -16968,6 +17018,7 @@ Ember.StateManager.reopen(
var get = Ember.get, set = Ember.set;
/**
@class
@deprecated
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.
@ -17717,11 +17768,13 @@ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
/**
Override the the opcode compiler and JavaScript compiler for Handlebars.
@private
*/
Ember.Handlebars.Compiler = function() {};
Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
/** @private */
Ember.Handlebars.JavaScriptCompiler = function() {};
Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
@ -17944,25 +17997,11 @@ var DOMManager = {
});
},
after: function(parentView, view, newView) {
newView._insertElementLater(function() {
var morph;
var nextView;
var prevView = view;
// 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;
}
after: function(view, nextView) {
nextView._insertElementLater(function() {
var morph = view.morph;
morph.after(nextView.outerHTML);
nextView.outerHTML = null;
});
},
@ -18518,7 +18557,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
// to which we were bound has been removed from the view.
// In that case, we can assume the template has been re-rendered
// and we need to clean up the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker);
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
// re-rendered and we've been nuked. Remove the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker);
} else {
// 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;
}
if (options.hasOwnProperty('contexts')) {
event.contexts = options.contexts;
}
var target = options.target;
// Check for StateManager (or compatible object)
@ -19590,7 +19633,7 @@ EmberHandlebars.registerHelper('action', function(actionName) {
var hash = options.hash,
view = options.data.view,
target, context, controller, link;
target, controller, link;
// create a hash to pass along to registerAction
var action = {
@ -19607,15 +19650,17 @@ EmberHandlebars.registerHelper('action', function(actionName) {
action.target = target = target || view;
// TODO: Support multiple contexts
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;
if (hash.href && target.urlForEvent) {
url = target.urlForEvent(actionName, context);
url = target.urlForEvent.apply(target, [actionName].concat(contexts));
output.push('href="' + url + '"');
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
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
*/
Ember.Checkbox = Ember.View.extend({
classNames: ['ember-checkbox'],
@ -19847,6 +19893,7 @@ Ember.TextSupport = Ember.Mixin.create(
insertNewline: Ember.K,
cancel: Ember.K,
/** @private */
init: function() {
this._super();
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
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends 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`
properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport
*/
Ember.TextArea = Ember.View.extend(Ember.TextSupport,
@ -20097,12 +20146,14 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
_updateElementValue: Ember.observer(function() {
// We do this check so cursor position doesn't get affected in IE
var value = get(this, 'value');
if (value !== this.$().val()) {
this.$().val(value);
var value = get(this, 'value'),
$el = this.$();
if ($el && value !== $el.val()) {
$el.val(value);
}
}, 'value'),
/** @private */
init: function() {
this._super();
this.on("didInsertElement", this, this._updateElementValue);
@ -20434,8 +20485,10 @@ Ember.Select = Ember.View.extend(
},
_selectionDidChangeSingle: function() {
var el = this.$()[0],
content = get(this, 'content'),
var el = this.get('element');
if (!el) { return; }
var content = get(this, 'content'),
selection = get(this, 'selection'),
selectionIndex = content ? indexOf(content, selection) : -1,
prompt = get(this, 'prompt');
@ -20609,6 +20662,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
});
};
/** @private */
function bootstrap() {
Ember.Handlebars.bootstrap( Ember.$(document) );
}
@ -20640,8 +20694,8 @@ Ember.onLoad('application', bootstrap);
})();
// Version: v0.9.8.1-675-g417213d
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre-5-gf1ec52a
// Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(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;
;
// Version: v0.9.8.1-675-g417213d
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre
// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
(function() {
@ -2096,8 +2096,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})();
// Version: v0.9.8.1-675-g417213d
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre-5-gf1ec52a
// Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() {
@ -2965,6 +2965,8 @@ function canInvoke(obj, methodName) {
/**
Checks to see if the `methodName` exists on the `obj`.
@function
@param {Object} obj The object to check for the method
@param {String} methodName The method name to check for
*/
@ -3654,8 +3656,22 @@ var Descriptor = Ember.Descriptor = function() {};
return this.firstName+' '+this.lastName;
}).property('firstName', 'lastName').cacheable());
*/
Ember.defineProperty = function(obj, keyName, desc, val, meta) {
var descs, existingDesc, watching;
Ember.defineProperty = function(obj, keyName, desc, data, meta) {
// 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);
descs = meta.descs;
@ -3667,6 +3683,8 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
}
if (desc instanceof Ember.Descriptor) {
value = desc;
descs[keyName] = desc;
if (MANDATORY_SETTER && watching) {
objectDefineProperty(obj, keyName, {
@ -3682,8 +3700,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
} else {
descs[keyName] = undefined; // shadow descriptor in proto
if (desc == null) {
value = data;
if (MANDATORY_SETTER && watching) {
meta.values[keyName] = val;
meta.values[keyName] = data;
objectDefineProperty(obj, keyName, {
configurable: true,
enumerable: true,
@ -3696,9 +3716,11 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
}
});
} else {
obj[keyName] = val;
obj[keyName] = data;
}
} else {
value = desc;
// compatibility with ES5
objectDefineProperty(obj, keyName, desc);
}
@ -3708,6 +3730,10 @@ Ember.defineProperty = function(obj, keyName, desc, val, meta) {
// were initialized with the prototype
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;
};
@ -4056,8 +4082,6 @@ function flushPendingChains() {
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);
if(pendingQueue.length > 0)
console.log(pendingQueue)
}
/** @private */
@ -4743,7 +4767,9 @@ var ComputedPropertyPrototype = ComputedProperty.prototype;
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
@returns {Ember.ComputedProperty} receiver
*/
@ -4762,7 +4788,9 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
}.property().volatile()
});
@name Ember.ComputedProperty.volatile
@memberOf Ember.ComputedProperty.prototype
@name volatile
@function
@returns {Ember.ComputedProperty} receiver
*/
ComputedPropertyPrototype.volatile = function() {
@ -4782,7 +4810,9 @@ ComputedPropertyPrototype.volatile = function() {
}).property('firstName', 'lastName')
});
@name Ember.ComputedProperty.property
@memberOf Ember.ComputedProperty.prototype
@name property
@function
@param {String} path... zero or more property paths
@returns {Ember.ComputedProperty} receiver
*/
@ -4813,14 +4843,20 @@ ComputedPropertyPrototype.property = function() {
exposes a public API for retrieving these values from classes,
via the `metaForProperty()` function.
@name Ember.ComputedProperty.meta
@param {Hash} metadata
@memberOf Ember.ComputedProperty.prototype
@name meta
@function
@param {Hash} meta
@returns {Ember.ComputedProperty} property descriptor instance
*/
ComputedPropertyPrototype.meta = function(meta) {
this._meta = meta;
return this;
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta;
return this;
}
};
/** @private - impl descriptor API */
@ -6868,6 +6904,17 @@ Ember.observer = function(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) {
var paths = a_slice.call(arguments, 1);
func.__ember_observesBefore__ = paths;
@ -8966,6 +9013,7 @@ Ember.Copyable = Ember.Mixin.create(
Override to return a copy of the receiver. Default implementation raises
an exception.
@function
@param deep {Boolean} if true, a deep copy of the object should be made
@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
then this method should raise an exception.
@function
@param {Object} object
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
then this method should raise an exception.
@function
@param {Object} object
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
array. You should also call this.enumerableContentDidChange() ;
@function
@param {Number} idx
Starting index in the array to replace. If idx >= length, then append
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.
*/
/**
@class
Ember.Location returns an instance of the correct implementation of
the `location` API.
@ -12302,11 +12358,18 @@ Ember.Location = {
var get = Ember.get, set = Ember.set;
/**
@class
Ember.HashLocation implements the location API using the browser's
hash. At present, it relies on a hashchange event existing in the
browser.
@extends Ember.Object
*/
Ember.HashLocation = Ember.Object.extend({
Ember.HashLocation = Ember.Object.extend(
/** @scope Ember.HashLocation.prototype */ {
/** @private */
init: function() {
set(this, 'location', get(this, 'location') || window.location);
},
@ -12366,6 +12429,7 @@ Ember.HashLocation = Ember.Object.extend({
return '#'+url;
},
/** @private */
willDestroy: function() {
var guid = Ember.guidFor(this);
@ -12383,10 +12447,17 @@ Ember.Location.registerImplementation('hash', Ember.HashLocation);
var get = Ember.get, set = Ember.set;
/**
@class
Ember.HistoryLocation implements the location API using the browser's
history.pushState API.
@extends Ember.Object
*/
Ember.HistoryLocation = Ember.Object.extend({
Ember.HistoryLocation = Ember.Object.extend(
/** @scope Ember.HistoryLocation.prototype */ {
/** @private */
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname);
@ -12424,8 +12495,7 @@ Ember.HistoryLocation = Ember.Object.extend({
path = this.formatPath(path);
if ((initialURL && initialURL !== path) || (state && state.path !== path)) {
set(this, '_initialURL', null);
if ((initialURL !== path && !state) || (state && state.path !== path)) {
window.history.pushState({ path: path }, null, path);
}
},
@ -12469,6 +12539,7 @@ Ember.HistoryLocation = Ember.Object.extend({
return url;
},
/** @private */
willDestroy: function() {
var guid = Ember.guidFor(this);
@ -12486,12 +12557,17 @@ Ember.Location.registerImplementation('history', Ember.HistoryLocation);
var get = Ember.get, set = Ember.set;
/**
@class
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
don't want it to muck with the URL (for example when you embed your
application in a larger page).
@extends Ember.Object
*/
Ember.NoneLocation = Ember.Object.extend({
Ember.NoneLocation = Ember.Object.extend(
/** @scope Ember.NoneLocation.prototype */ {
path: '',
getURL: function() {
@ -14046,10 +14122,6 @@ Ember.View = Ember.Object.extend(Ember.Evented,
_parentView: null,
// allow navigation between the next and previous views
prevView: null,
nextView: null,
// return the current view, not including virtual views
concreteView: Ember.computed(function() {
if (!this.isVirtual) { return this; }
@ -14415,6 +14487,8 @@ Ember.View = Ember.Object.extend(Ember.Evented,
// JavaScript property changes.
var observer = function() {
elem = this.$();
if (!elem) { return; }
attributeValue = get(this, property);
Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);
@ -15226,9 +15300,12 @@ Ember.View = Ember.Object.extend(Ember.Evented,
element of the actual DOM element.
*/
_isVisibleDidChange: Ember.observer(function() {
var $el = this.$();
if (!$el) { return; }
var isVisible = get(this, 'isVisible');
this.$().toggle(isVisible);
$el.toggle(isVisible);
if (this._isAncestorHidden()) { return; }
@ -15361,22 +15438,10 @@ var DOMManager = {
});
},
after: function(parentView, view, newView) {
newView._insertElementLater(function() {
var nextView;
var prevView = view;
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.$());
}
after: function(view, nextView) {
nextView._insertElementLater(function() {
var element = view.$();
element.after(nextView.$());
});
},
@ -15544,7 +15609,7 @@ Ember.View.states = {
},
$: function() {
return Ember.$();
return undefined;
},
getElement: function() {
@ -15649,13 +15714,7 @@ Ember.View.states.inBuffer = {
var buffer = view.buffer;
childView = this.createChildView(childView, options);
var childViews = get(view, '_childViews');
if (childViews.length > 0) {
childViews[childViews.length-1].nextView = childView;
childView.prevView = childViews[childViews.length-1];
}
childViews.push(childView);
view._childViews.push(childView);
childView.renderToBuffer(buffer);
@ -16074,10 +16133,6 @@ Ember.ContainerView = Ember.View.extend({
view = this.createChildView(viewName);
}
if (idx>0) {
_childViews[idx-1].nextView = view;
view.prevView = _childViews[idx-1];
}
_childViews[idx] = view;
}, this);
@ -16193,7 +16248,7 @@ Ember.ContainerView = Ember.View.extend({
*/
_scheduleInsertion: function(view, prev) {
if (prev) {
prev.domManager.after(this, prev, view);
prev.domManager.after(prev, view);
} else {
this.domManager.prepend(this, view);
}
@ -16514,15 +16569,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
if (removingAll) { childView.removedFromDOM = true; }
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
});
// 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);
}
} else {
@ -16578,20 +16619,6 @@ Ember.CollectionView = Ember.ContainerView.extend(
addedViews.push(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);
},
@ -17840,6 +17867,10 @@ var merge = function(original, hash) {
}
};
/**
@class
@extends Ember.Mixin
*/
Ember.Routable = Ember.Mixin.create({
init: function() {
var redirection;
@ -18176,8 +18207,10 @@ Ember.Routable = Ember.Mixin.create({
state of the state it will eventually move into.
*/
unroutePath: function(router, path) {
var parentState = get(this, 'parentState');
// If we're at the root state, we're done
if (get(this, 'parentState') === router) {
if (parentState === router) {
return;
}
@ -18200,8 +18233,12 @@ Ember.Routable = Ember.Mixin.create({
}
// Transition to the parent and call unroute again.
var parentPath = get(get(this, 'parentState'), 'path');
router.transitionTo(parentPath);
router.enterState({
exitStates: [this],
enterStates: [],
finalState: parentState
});
router.send('unroutePath', path);
},
@ -18226,6 +18263,7 @@ Ember.Routable = Ember.Mixin.create({
(function() {
/**
@class
@extends Ember.Routable
*/
Ember.Route = Ember.State.extend(Ember.Routable);
@ -18298,6 +18336,15 @@ Ember._RouteMatcher = Ember.Object.extend({
(function() {
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
@ -18783,7 +18830,8 @@ Ember.Router = Ember.StateManager.extend(
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 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);
var hash = this.serializeRecursively(targetState, context);
var hash = this.serializeRecursively(targetState, contexts, {});
return this.urlFor(targetStateName, hash);
},
/** @private */
serializeRecursively: function(state, hash) {
hash = state.serialize(this, hash);
var parentState = state.get("parentState");
serializeRecursively: function(state, contexts, hash) {
var parentState,
context = get(state, 'hasContext') ? contexts.pop() : null;
merge(hash, state.serialize(this, context));
parentState = state.get("parentState");
if (parentState && parentState instanceof Ember.Route) {
return this.serializeRecursively(parentState, hash);
return this.serializeRecursively(parentState, contexts, hash);
} else {
return hash;
}
@ -18922,6 +18972,7 @@ Ember.StateManager.reopen(
var get = Ember.get, set = Ember.set;
/**
@class
@deprecated
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.
@ -19671,11 +19722,13 @@ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
/**
Override the the opcode compiler and JavaScript compiler for Handlebars.
@private
*/
Ember.Handlebars.Compiler = function() {};
Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
/** @private */
Ember.Handlebars.JavaScriptCompiler = function() {};
Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
@ -19898,25 +19951,11 @@ var DOMManager = {
});
},
after: function(parentView, view, newView) {
newView._insertElementLater(function() {
var morph;
var nextView;
var prevView = view;
// 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;
}
after: function(view, nextView) {
nextView._insertElementLater(function() {
var morph = view.morph;
morph.after(nextView.outerHTML);
nextView.outerHTML = null;
});
},
@ -20472,7 +20511,7 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
// to which we were bound has been removed from the view.
// In that case, we can assume the template has been re-rendered
// and we need to clean up the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker);
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
// re-rendered and we've been nuked. Remove the observer.
if (elem.length === 0) {
if (!elem || elem.length === 0) {
Ember.removeObserver(pathRoot, path, invoker);
} else {
// 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;
}
if (options.hasOwnProperty('contexts')) {
event.contexts = options.contexts;
}
var target = options.target;
// Check for StateManager (or compatible object)
@ -21544,7 +21587,7 @@ EmberHandlebars.registerHelper('action', function(actionName) {
var hash = options.hash,
view = options.data.view,
target, context, controller, link;
target, controller, link;
// create a hash to pass along to registerAction
var action = {
@ -21561,15 +21604,17 @@ EmberHandlebars.registerHelper('action', function(actionName) {
action.target = target = target || view;
// TODO: Support multiple contexts
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;
if (hash.href && target.urlForEvent) {
url = target.urlForEvent(actionName, context);
url = target.urlForEvent.apply(target, [actionName].concat(contexts));
output.push('href="' + url + '"');
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
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
*/
Ember.Checkbox = Ember.View.extend({
classNames: ['ember-checkbox'],
@ -21801,6 +21847,7 @@ Ember.TextSupport = Ember.Mixin.create(
insertNewline: Ember.K,
cancel: Ember.K,
/** @private */
init: function() {
this._super();
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
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends 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`
properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.View
@extends Ember.TextSupport
*/
Ember.TextArea = Ember.View.extend(Ember.TextSupport,
@ -22051,12 +22100,14 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
_updateElementValue: Ember.observer(function() {
// We do this check so cursor position doesn't get affected in IE
var value = get(this, 'value');
if (value !== this.$().val()) {
this.$().val(value);
var value = get(this, 'value'),
$el = this.$();
if ($el && value !== $el.val()) {
$el.val(value);
}
}, 'value'),
/** @private */
init: function() {
this._super();
this.on("didInsertElement", this, this._updateElementValue);
@ -22388,8 +22439,10 @@ Ember.Select = Ember.View.extend(
},
_selectionDidChangeSingle: function() {
var el = this.$()[0],
content = get(this, 'content'),
var el = this.get('element');
if (!el) { return; }
var content = get(this, 'content'),
selection = get(this, 'selection'),
selectionIndex = content ? indexOf(content, selection) : -1,
prompt = get(this, 'prompt');
@ -22563,6 +22616,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
});
};
/** @private */
function bootstrap() {
Ember.Handlebars.bootstrap( Ember.$(document) );
}
@ -22594,8 +22648,8 @@ Ember.onLoad('application', bootstrap);
})();
// Version: v0.9.8.1-675-g417213d
// Last commit: 417213d (2012-07-30 13:06:36 +0200)
// Version: v1.0.pre-5-gf1ec52a
// Last commit: f1ec52a (2012-08-06 17:23:55 -0700)
(function() {