dist/ember.js in ember-source-1.0.0.rc4.1 vs dist/ember.js in ember-source-1.0.0.rc5
- old
+ new
@@ -1,7 +1,7 @@
-// Version: v1.0.0-rc.4-2-g7f3974d
-// Last commit: 7f3974d (2013-07-25 20:17:33 -0400)
+// Version: v1.0.0-rc.5-3-g835b8e5
+// Last commit: 835b8e5 (2013-06-01 14:23:38 -0400)
(function() {
/*global __fail__*/
@@ -149,12 +149,12 @@
};
};
})();
-// Version: v1.0.0-rc.4-2-g7f3974d
-// Last commit: 7f3974d (2013-07-25 20:17:33 -0400)
+// Version: v1.0.0-rc.5-3-g835b8e5
+// Last commit: 835b8e5 (2013-06-01 14:23:38 -0400)
(function() {
var define, requireModule;
@@ -217,11 +217,11 @@
The core Runtime framework is based on the jQuery API with a number of
performance optimizations.
@class Ember
@static
- @version 1.0.0-rc.4
+ @version 1.0.0-rc.5
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
// objects assigned to it are given a sane string representation.
@@ -244,14 +244,14 @@
/**
@property VERSION
@type String
- @default '1.0.0-rc.4'
+ @default '1.0.0-rc.5'
@final
*/
-Ember.VERSION = '1.0.0-rc.4';
+Ember.VERSION = '1.0.0-rc.5';
/**
Standard environmental variables. You can define these in a global `ENV`
variable before loading Ember to control various configuration
settings.
@@ -4628,11 +4628,11 @@
if (typeof method === 'string') {
method = target[method];
}
- var stack = new Error().stack,
+ var stack = this.DEBUG ? new Error().stack : undefined,
args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
if (!this.currentInstance) { createAutorun(this); }
return this.currentInstance.schedule(queueName, target, method, args, false, stack);
},
@@ -4644,11 +4644,11 @@
if (typeof method === 'string') {
method = target[method];
}
- var stack = new Error().stack,
+ var stack = this.DEBUG ? new Error().stack : undefined,
args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
if (!this.currentInstance) { createAutorun(this); }
return this.currentInstance.schedule(queueName, target, method, args, true, stack);
},
@@ -4693,11 +4693,11 @@
if (laterTimer) {
clearTimeout(laterTimer);
laterTimer = null;
}
- laterTimer = setTimeout(function() {
+ laterTimer = window.setTimeout(function() {
executeTimers(self);
laterTimer = null;
laterTimerExpiresAt = null;
}, wait);
laterTimerExpiresAt = executeAt;
@@ -4714,11 +4714,11 @@
for (var i = 0, l = debouncees.length; i < l; i++) {
debouncee = debouncees[i];
if (debouncee[0] === target && debouncee[1] === method) { return; } // do nothing
}
- var timer = setTimeout(function() {
+ var timer = window.setTimeout(function() {
self.run.apply(self, args);
// remove debouncee
var index = -1;
for (var i = 0, l = debouncees.length; i < l; i++) {
@@ -4775,11 +4775,11 @@
Backburner.prototype.scheduleOnce = Backburner.prototype.deferOnce;
Backburner.prototype.later = Backburner.prototype.setTimeout;
function createAutorun(backburner) {
backburner.begin();
- autorun = setTimeout(function() {
+ autorun = window.setTimeout(function() {
backburner.end();
autorun = null;
});
}
@@ -4800,11 +4800,11 @@
self.schedule(self.options.defaultQueue, null, fns[i]);
}
});
if (timers.length) {
- laterTimer = setTimeout(function() {
+ laterTimer = window.setTimeout(function() {
executeTimers(self);
laterTimer = null;
laterTimerExpiresAt = null;
}, timers[0] - now);
laterTimerExpiresAt = timers[0];
@@ -6578,10 +6578,33 @@
return Ember.observer.apply(this, arguments);
};
/**
+ When observers fire, they are called with the arguments `obj`, `keyName`
+ and `value`. In a typical observer, value is the new, post-change value.
+
+ A `beforeObserver` fires before a property changes. The `value` argument contains
+ the pre-change value.
+
+ A `beforeObserver` is an alternative form of `.observesBefore()`.
+
+ ```javascript
+ App.PersonView = Ember.View.extend({
+ valueWillChange: function (obj, keyName, value) {
+ this.changingFrom = value;
+ }.observesBefore('content.value'),
+ valueDidChange: function(obj, keyName, value) {
+ // only run if updating a value already in the DOM
+ if(this.get('state') === 'inDOM') {
+ var color = value > this.changingFrom ? 'green' : 'red';
+ // logic
+ }
+ }.observes('content.value')
+ });
+ ```
+
@method beforeObserver
@for Ember
@param {Function} func
@param {String} propertyNames*
@return func
@@ -14089,49 +14112,10 @@
toDOM: function() {
return this.list.join(" ");
}
};
-var BAD_TAG_NAME_TEST_REGEXP = /[^a-zA-Z\-]/;
-var BAD_TAG_NAME_REPLACE_REGEXP = /[^a-zA-Z\-]/g;
-
-function stripTagName(tagName) {
- if (!tagName) {
- return tagName;
- }
-
- if (!BAD_TAG_NAME_TEST_REGEXP.test(tagName)) {
- return tagName;
- }
-
- return tagName.replace(BAD_TAG_NAME_REPLACE_REGEXP, '');
-}
-
-var BAD_CHARS_REGEXP = /&(?!\w+;)|[<>"'`]/g;
-var POSSIBLE_CHARS_REGEXP = /[&<>"'`]/;
-
-function escapeAttribute(value) {
- // Stolen shamelessly from Handlebars
-
- var escape = {
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- "`": "`"
- };
-
- var escapeChar = function(chr) {
- return escape[chr] || "&";
- };
-
- var string = value.toString();
-
- if(!POSSIBLE_CHARS_REGEXP.test(string)) { return string; }
- return string.replace(BAD_CHARS_REGEXP, escapeChar);
-}
-
/**
`Ember.RenderBuffer` gathers information regarding the a view and generates the
final representation. `Ember.RenderBuffer` will generate HTML which can be pushed
to the DOM.
@@ -14415,27 +14399,27 @@
attrs = this.elementAttributes,
props = this.elementProperties,
style = this.elementStyle,
attr, prop;
- buffer += '<' + stripTagName(tagName);
+ buffer += '<' + tagName;
if (id) {
- buffer += ' id="' + escapeAttribute(id) + '"';
+ buffer += ' id="' + this._escapeAttribute(id) + '"';
this.elementId = null;
}
if (classes) {
- buffer += ' class="' + escapeAttribute(classes.join(' ')) + '"';
+ buffer += ' class="' + this._escapeAttribute(classes.join(' ')) + '"';
this.classes = null;
}
if (style) {
buffer += ' style="';
for (prop in style) {
if (style.hasOwnProperty(prop)) {
- buffer += prop + ':' + escapeAttribute(style[prop]) + ';';
+ buffer += prop + ':' + this._escapeAttribute(style[prop]) + ';';
}
}
buffer += '"';
@@ -14443,11 +14427,11 @@
}
if (attrs) {
for (attr in attrs) {
if (attrs.hasOwnProperty(attr)) {
- buffer += ' ' + attr + '="' + escapeAttribute(attrs[attr]) + '"';
+ buffer += ' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"';
}
}
this.elementAttributes = null;
}
@@ -14458,11 +14442,11 @@
var value = props[prop];
if (value || typeof(value) === 'number') {
if (value === true) {
buffer += ' ' + prop + '="' + prop + '"';
} else {
- buffer += ' ' + prop + '="' + escapeAttribute(props[prop]) + '"';
+ buffer += ' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"';
}
}
}
}
@@ -14473,11 +14457,11 @@
this.buffer = buffer;
},
pushClosingTag: function() {
var tagName = this.tagNames.pop();
- if (tagName) { this.buffer += '</' + stripTagName(tagName) + '>'; }
+ if (tagName) { this.buffer += '</' + tagName + '>'; }
},
currentTagName: function() {
return this.tagNames[this.tagNames.length-1];
},
@@ -14571,11 +14555,36 @@
}
},
innerString: function() {
return this.buffer;
+ },
+
+ _escapeAttribute: function(value) {
+ // Stolen shamelessly from Handlebars
+
+ var escape = {
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'",
+ "`": "`"
+ };
+
+ var badChars = /&(?!\w+;)|[<>"'`]/g;
+ var possible = /[&<>"'`]/;
+
+ var escapeChar = function(chr) {
+ return escape[chr] || "&";
+ };
+
+ var string = value.toString();
+
+ if(!possible.test(string)) { return string; }
+ return string.replace(badChars, escapeChar);
}
+
};
})();
@@ -19063,11 +19072,11 @@
}
Ember.Handlebars.helper = function(name, value) {
if (Ember.View.detect(value)) {
Ember.Handlebars.registerHelper(name, function(options) {
- Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3);
+ Ember.assert("You can only pass attributes as parameters (not values) to a application-defined helper", arguments.length < 2);
makeBindings(options);
return Ember.Handlebars.helpers.view.call(this, value, options);
});
} else {
Ember.Handlebars.registerBoundHelper.apply(null, arguments);
@@ -23777,11 +23786,11 @@
Clears the current and target route handlers and triggers exit
on each of them starting at the leaf and traversing up through
its ancestors.
*/
reset: function() {
- eachHandler(this.currentHandlerInfos, function(handler) {
+ eachHandler(this.currentHandlerInfos || [], function(handler) {
if (handler.exit) {
handler.exit();
}
});
this.currentHandlerInfos = null;
@@ -24919,10 +24928,13 @@
/**
Transition into another route while replacing the current URL if
possible. Identical to `transitionTo` in all other respects.
+ Of the bundled location types, only `history` currently supports
+ this behavior.
+
@method replaceWith
@param {String} name the name of the route
@param {...Object} models the
*/
replaceWith: function() {
@@ -25361,10 +25373,12 @@
});
function parentRoute(route) {
var handlerInfos = route.router.router.targetHandlerInfos;
+ if (!handlerInfos) { return; }
+
var parent, current;
for (var i=0, l=handlerInfos.length; i<l; i++) {
current = handlerInfos[i].handler;
if (current === route) { return parent; }
@@ -26275,11 +26289,11 @@
`{{outlet}}` helper, actions will bubble to the current controller, then
to the current route, and then up the route hierarchy.
Alternatively, a `target` option can be provided to the helper to change
which object will receive the method call. This option must be a path
- path to an object, accessible in the current context:
+ to an object, accessible in the current context:
```handlebars
<script type="text/x-handlebars" data-template-name='a-template'>
<div {{action anActionName target="MyApplication.someObject"}}>
click me
@@ -28096,14 +28110,15 @@
return resolver.resolve(fullName);
};
}
function normalize(fullName) {
- var split = fullName.split(':'),
+ var split = fullName.split(':', 2),
type = split[0],
name = split[1];
+ Ember.assert("Tried to normalize a container name without a colon (:) in it. You probably tried to lookup a name that did not contain a type, a colon, and a name. A proper lookup name would be `view:post`.", split.length === 2);
if (type !== 'template') {
var result = name;
if (result.indexOf('.') > -1) {
@@ -29923,20 +29938,16 @@
(function() {
})();
-
-})();
-// Version: v1.0.0-rc.4-2-g7f3974d
-// Last commit: 7f3974d (2013-07-25 20:17:33 -0400)
-
-
(function() {
/**
Ember
@module ember
*/
})();
+
+})();