Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the development version of Ember.js.

In addition to being easier to debug because it's
unminified, the development version of Ember.js
also includes many helpful assertions that are
stripped from the production version.

You should use this version during development
because it will provide you with more helpful
error messages.
  • Loading branch information...
commit b16cbe004ec5a5bb7150339a53399e6e3816c08a 1 parent 85bfe71
@tomdale authored
Showing with 53 additions and 32 deletions.
  1. +1 −1  app/config.js
  2. +52 −31 lib/ember.js
View
2  app/config.js
@@ -8,7 +8,7 @@ requirejs.config({
// Libraries
jquery : '../lib/jquery',
handlebars : '../lib/handlebars',
- Ember : '../lib/ember.min',
+ Ember : '../lib/ember',
templates : './templates',
hbs : '../lib/hbs',
Handlebars : '../lib/Handlebars',
View
83 lib/ember.js
@@ -1,5 +1,5 @@
-// Version: v0.9.8.1-458-ge3106a5
-// Last commit: e3106a5 (2012-06-28 08:43:09 -0700)
+// Version: v0.9.8.1-462-g541d085
+// Last commit: 541d085 (2012-06-29 20:54:45 -0700)
(function() {
@@ -136,8 +136,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})();
-// Version: v0.9.8.1-458-ge3106a5
-// Last commit: e3106a5 (2012-06-28 08:43:09 -0700)
+// Version: v0.9.8.1-462-g541d085
+// Last commit: 541d085 (2012-06-29 20:54:45 -0700)
(function() {
@@ -10632,12 +10632,20 @@ var get = Ember.get, set = Ember.set;
Ember.HistoryLocation = Ember.Object.extend({
init: function() {
set(this, 'location', get(this, 'location') || window.location);
+ set(this, '_initialURL', get(this, 'location').pathname);
set(this, 'callbacks', Ember.A());
},
/**
@private
+ Used to give history a starting reference
+ */
+ _initialURL: null,
+
+ /**
+ @private
+
Returns the current `location.pathname`.
*/
getURL: function() {
@@ -10650,12 +10658,13 @@ Ember.HistoryLocation = Ember.Object.extend({
Uses `history.pushState` to update the url without a page reload.
*/
setURL: function(path) {
- var state = window.history.state;
+ var state = window.history.state,
+ initialURL = get(this, '_initialURL');
+
if (path === "") { path = '/'; }
- // We only want pushState to be executed if we are passing
- // in a new path, otherwise a new state will be inserted
- // for the same path.
- if ((!state && path !== '/') || (state && state.path !== path)) {
+
+ if ((initialURL && initialURL !== path) || (state && state.path !== path)) {
+ set(this, '_initialURL', null);
window.history.pushState({ path: path }, null, path);
}
},
@@ -11575,6 +11584,17 @@ var childViewsProperty = Ember.computed(function() {
return ret;
}).property().cacheable();
+var controllerProperty = Ember.computed(function(key, value) {
+ var parentView;
+
+ if (arguments.length === 2) {
+ return value;
+ } else {
+ parentView = get(this, 'parentView');
+ return parentView ? get(parentView, 'controller') : null;
+ }
+}).property().cacheable();
+
var VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;
Ember.warn("The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.", VIEW_PRESERVES_CONTEXT);
@@ -12043,17 +12063,7 @@ Ember.View = Ember.Object.extend(Ember.Evented,
@type Object
*/
- controller: Ember.computed(function(key, value) {
- var parentView;
-
- if (arguments.length === 2) {
- return value;
- } else {
- parentView = get(this, 'parentView');
- return parentView ? get(parentView, 'controller') : null;
- }
- }).property().cacheable(),
-
+ controller: controllerProperty,
/**
A view may contain a layout. A layout is a regular template but
supersedes the `template` property during rendering. It is the
@@ -12118,20 +12128,22 @@ Ember.View = Ember.Object.extend(Ember.Evented,
to be re-rendered.
*/
_context: Ember.computed(function(key, value) {
- var parentView, controller;
+ var parentView, context;
if (arguments.length === 2) {
return value;
}
if (VIEW_PRESERVES_CONTEXT) {
- if (controller = get(this, 'controller')) {
- return controller;
+ if (Ember.meta(this).descs.controller !== controllerProperty) {
+ if (context = get(this, 'controller')) {
+ return context;
+ }
}
parentView = get(this, '_parentView');
- if (parentView) {
- return get(parentView, '_context');
+ if (parentView && (context = get(parentView, '_context'))) {
+ return context;
}
}
@@ -14802,6 +14814,12 @@ Ember.State = Ember.Object.extend(Ember.Evented,
}).cacheable(),
/**
+ A boolean value indicating whether the state takes a context.
+ By default we assume all states take contexts.
+ */
+ hasContext: true,
+
+ /**
This is the default transition event.
@event
@@ -15321,7 +15339,6 @@ Ember.StateManager = Ember.State.extend(
send: function(event, context) {
Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
- if (arguments.length === 1) { context = {}; }
return this.sendRecursively(event, get(this, 'currentState'), context);
},
@@ -15488,7 +15505,7 @@ Ember.StateManager = Ember.State.extend(
exitStates.unshift(state);
}
- useContext = context && (!get(state, 'isRoutable') || get(state, 'isDynamic'));
+ useContext = context && get(state, 'hasContext');
matchedContexts.unshift(useContext ? contexts.pop() : null);
}
@@ -15500,6 +15517,7 @@ Ember.StateManager = Ember.State.extend(
state = getPath(state, 'states.'+initialState);
if (!state) { break; }
enterStates.push(state);
+ matchedContexts.push(undefined);
}
while (enterStates.length > 0) {
@@ -15730,9 +15748,10 @@ Ember.Routable = Ember.Mixin.create({
/**
@private
- Check whether the route has dynamic segments
+ Check whether the route has dynamic segments and therefore takes
+ a context.
*/
- isDynamic: Ember.computed(function() {
+ hasContext: Ember.computed(function() {
var routeMatcher = get(this, 'routeMatcher');
if (routeMatcher) {
return routeMatcher.identifiers.length > 0;
@@ -18842,6 +18861,8 @@ Ember.Handlebars.EachView = Ember.CollectionView.extend(Ember._Metamorph, {
// In this case, we do not bind, because the `content` of
// a #each item cannot change.
data.keywords[keyword] = content;
+ } else {
+ set(view, 'controller', get(view, 'content'));
}
return view;
@@ -20112,8 +20133,8 @@ Ember.$(document).ready(
})();
-// Version: v0.9.8.1-458-ge3106a5
-// Last commit: e3106a5 (2012-06-28 08:43:09 -0700)
+// Version: v0.9.8.1-462-g541d085
+// Last commit: 541d085 (2012-06-29 20:54:45 -0700)
(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.