Skip to content

Instantly share code, notes, and snippets.

@jdjkelly
Created July 26, 2013 16:05
Show Gist options
  • Save jdjkelly/6090079 to your computer and use it in GitHub Desktop.
Save jdjkelly/6090079 to your computer and use it in GitHub Desktop.
191962531eb67bdd66847a68544238ce69073838: ember.js vs ember.prod.js
--- /Users/sycr/code/embertest/dist/ember.js Fri Jul 26 12:00:26 2013
+++ /Users/sycr/code/embertest/dist/ember.prod.js Fri Jul 26 12:00:26 2013
@@ -1,160 +1,3 @@
-// Version: v1.0.0-rc.3.1
-// Last commit: 1919625 (2013-07-25 18:13:08 -0400)
-
-
-(function() {
-/*global __fail__*/
-
-/**
-Ember Debug
-
-@module ember
-@submodule ember-debug
-*/
-
-/**
-@class Ember
-*/
-
-if ('undefined' === typeof Ember) {
- Ember = {};
-
- if ('undefined' !== typeof window) {
- window.Em = window.Ember = Em = Ember;
- }
-}
-
-Ember.ENV = 'undefined' === typeof ENV ? {} : ENV;
-
-if (!('MANDATORY_SETTER' in Ember.ENV)) {
- Ember.ENV.MANDATORY_SETTER = true; // default to true for debug dist
-}
-
-/**
- Define an assertion that will throw an exception if the condition is not
- met. Ember build tools will remove any calls to `Ember.assert()` when
- doing a production build. Example:
-
- ```javascript
- // Test for truthiness
- Ember.assert('Must pass a valid object', obj);
- // Fail unconditionally
- Ember.assert('This code path should never be run')
- ```
-
- @method assert
- @param {String} desc A description of the assertion. This will become
- the text of the Error thrown if the assertion fails.
- @param {Boolean} test Must be truthy for the assertion to pass. If
- falsy, an exception will be thrown.
-*/
-Ember.assert = function(desc, test) {
- if (!test) throw new Error("assertion failed: "+desc);
-};
-
-
-/**
- Display a warning with the provided message. Ember build tools will
- remove any calls to `Ember.warn()` when doing a production build.
-
- @method warn
- @param {String} message A warning to display.
- @param {Boolean} test An optional boolean. If falsy, the warning
- will be displayed.
-*/
-Ember.warn = function(message, test) {
- if (!test) {
- Ember.Logger.warn("WARNING: "+message);
- if ('trace' in Ember.Logger) Ember.Logger.trace();
- }
-};
-
-/**
- Display a debug notice. Ember build tools will remove any calls to
- `Ember.debug()` when doing a production build.
-
- ```javascript
- Ember.debug("I'm a debug notice!");
- ```
-
- @method debug
- @param {String} message A debug message to display.
-*/
-Ember.debug = function(message) {
- Ember.Logger.debug("DEBUG: "+message);
-};
-
-/**
- Display a deprecation warning with the provided message and a stack trace
- (Chrome and Firefox only). Ember build tools will remove any calls to
- `Ember.deprecate()` when doing a production build.
-
- @method deprecate
- @param {String} message A description of the deprecation.
- @param {Boolean} test An optional boolean. If falsy, the deprecation
- will be displayed.
-*/
-Ember.deprecate = function(message, test) {
- if (Ember && Ember.TESTING_DEPRECATION) { return; }
-
- if (arguments.length === 1) { test = false; }
- if (test) { return; }
-
- if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }
-
- var error;
-
- // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
- try { __fail__.fail(); } catch (e) { error = e; }
-
- if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
- var stack, stackStr = '';
- if (error['arguments']) {
- // Chrome
- stack = error.stack.replace(/^\s+at\s+/gm, '').
- replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').
- replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
- stack.shift();
- } else {
- // Firefox
- stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').
- replace(/^\(/gm, '{anonymous}(').split('\n');
- }
-
- stackStr = "\n " + stack.slice(2).join("\n ");
- message = message + stackStr;
- }
-
- Ember.Logger.warn("DEPRECATION: "+message);
-};
-
-
-
-/**
- Display a deprecation warning with the provided message and a stack trace
- (Chrome and Firefox only) when the wrapped method is called.
-
- Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
- no warnings will be shown in production.
-
- @method deprecateFunc
- @param {String} message A description of the deprecation.
- @param {Function} func The function to be deprecated.
- @return {Function} a new function that wrapped the original function with a deprecation warning
-*/
-Ember.deprecateFunc = function(message, func) {
- return function() {
- Ember.deprecate(message);
- return func.apply(this, arguments);
- };
-};
-
-})();
-
-// Version: v1.0.0-rc.3.1
-// Last commit: 1919625 (2013-07-25 18:13:08 -0400)
-
-
(function() {
var define, requireModule;
@@ -1993,11 +1836,10 @@
}
if (!obj || keyName.indexOf('.') !== -1) {
- Ember.assert("Cannot call get with '"+ keyName +"' on an undefined object.", obj !== undefined);
+
return getPath(obj, keyName);
}
- Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
var meta = obj[META_KEY], desc = meta && meta.descs[keyName], ret;
if (desc) {
@@ -2219,7 +2061,7 @@
@param {Boolean} once A flag whether a function should only be called once
*/
function addListener(obj, eventName, target, method, once) {
- Ember.assert("You must pass at least an object and event name to Ember.addListener", !!obj && !!eventName);
+
if (!method && 'function' === typeof target) {
method = target;
@@ -2251,7 +2093,7 @@
@param {Function|String} method A function or the name of a function to be called on `target`
*/
function removeListener(obj, eventName, target, method) {
- Ember.assert("You must pass at least an object and event name to Ember.removeListener", !!obj && !!eventName);
+
if (!method && 'function' === typeof target) {
method = target;
@@ -2806,7 +2648,7 @@
*/
var set = function set(obj, keyName, value, tolerant) {
if (typeof obj === 'string') {
- Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
+
value = keyName;
keyName = obj;
obj = null;
@@ -2816,8 +2658,7 @@
return setPath(obj, keyName, value, tolerant);
}
- Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
- Ember.assert('calling set on destroyed object', !obj.isDestroyed);
+
var meta = obj[META_KEY], desc = meta && meta.descs[keyName],
isUnknown, currentValue;
@@ -2950,7 +2791,7 @@
//
var MANDATORY_SETTER_FUNCTION = Ember.MANDATORY_SETTER_FUNCTION = function(value) {
- Ember.assert("You must use Ember.set() to access this property (of " + this + ")", false);
+
};
var DEFAULT_GETTER_FUNCTION = Ember.DEFAULT_GETTER_FUNCTION = function(name) {
@@ -3659,7 +3500,6 @@
@module ember-metal
*/
-Ember.warn("The CP_DEFAULT_CACHEABLE flag has been removed and computed properties are always cached by default. Use `volatile` if you don't want caching.", Ember.ENV.CP_DEFAULT_CACHEABLE !== false);
var get = Ember.get,
@@ -3908,7 +3748,7 @@
ComputedPropertyPrototype.willWatch = function(obj, keyName) {
// watch already creates meta for this instance
var meta = obj[META_KEY];
- Ember.assert('watch should have setup meta to be writable', meta.source === obj);
+
if (!(keyName in meta.cache)) {
addDependentKeys(this, obj, keyName, meta);
}
@@ -3916,7 +3756,7 @@
ComputedPropertyPrototype.didUnwatch = function(obj, keyName) {
var meta = obj[META_KEY];
- Ember.assert('unwatch should have setup meta to be writable', meta.source === obj);
+
if (!(keyName in meta.cache)) {
// unwatch already creates meta for this instance
removeDependentKeys(this, obj, keyName, meta);
@@ -4727,7 +4567,7 @@
@return {void}
*/
Ember.run.end = function() {
- Ember.assert('must have a current run loop', run.currentRunLoop);
+
function tryable() { run.currentRunLoop.end(); }
function finalizer() { run.currentRunLoop = run.currentRunLoop.prev(); }
@@ -4825,7 +4665,7 @@
*/
Ember.run.autorun = function() {
if (!run.currentRunLoop) {
- Ember.assert("You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run", !Ember.testing);
+
run.begin();
@@ -5301,7 +5141,7 @@
@return {Ember.Binding} `this`
*/
connect: function(obj) {
- Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
+
var fromPath = this._from, toPath = this._to;
Ember.trySet(obj, toPath, getWithGlobals(obj, fromPath));
@@ -5326,7 +5166,7 @@
@return {Ember.Binding} `this`
*/
disconnect: function(obj) {
- Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);
+
var twoWay = !this._oneWay;
@@ -5791,7 +5631,7 @@
for(var i=0, l=mixins.length; i<l; i++) {
mixin = mixins[i];
- Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
+
props = mixinProperties(m, mixin);
if (props === CONTINUE) { continue; }
@@ -6072,7 +5912,7 @@
for(idx=0; idx < len; idx++) {
mixin = arguments[idx];
- Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
+
if (mixin instanceof Mixin) {
mixins.push(mixin);
@@ -6274,7 +6114,7 @@
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);
@@ -6678,7 +6518,7 @@
factory = name;
fullName = type;
} else {
- Ember.deprecate('register("'+type +'", "'+ name+'") is now deprecated in-favour of register("'+type+':'+name+'");', false);
+
fullName = type + ":" + name;
}
@@ -7007,7 +6847,6 @@
// avoid cyclical loops
if (deep && (loc=indexOf(seen, obj))>=0) return copies[loc];
- Ember.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof Ember.Object) || (Ember.Copyable && Ember.Copyable.detect(obj)));
// IMPORTANT: this specific test will detect a native array only. Any other
// object will need to implement Copyable.
@@ -10033,7 +9872,7 @@
@return {Object} The property value or undefined.
*/
getPath: function(path) {
- Ember.deprecate("getPath is deprecated since get now supports paths");
+
return this.get(path);
},
@@ -10045,7 +9884,7 @@
@return {Ember.Observable}
*/
setPath: function(path, value) {
- Ember.deprecate("setPath is deprecated since set now supports paths");
+
return this.set(path, value);
},
@@ -10261,7 +10100,7 @@
if (target.send) {
ret = target.send.apply(target, [action, actionContext]);
} else {
- Ember.assert("The action '" + action + "' did not exist on " + target, typeof target[action] === 'function');
+
ret = target[action].apply(target, [actionContext]);
}
@@ -10399,7 +10238,7 @@
},
fire: function(name) {
- Ember.deprecate("Ember.Evented#fire() has been deprecated in favor of trigger() for compatibility with jQuery. It will be removed in 1.0. Please update your code to call trigger() instead.");
+
this.trigger.apply(this, arguments);
},
@@ -10575,7 +10414,6 @@
for (var i = 0, l = props.length; i < l; i++) {
var properties = props[i];
- Ember.assert("Ember.Object.create no longer supports mixing in other definitions, use createWithMixins instead.", !(properties instanceof Ember.Mixin));
for (var keyName in properties) {
if (!properties.hasOwnProperty(keyName)) { continue; }
@@ -10595,8 +10433,7 @@
var desc = m.descs[keyName];
- Ember.assert("Ember.Object.create no longer supports defining computed properties.", !(value instanceof Ember.ComputedProperty));
- Ember.assert("Ember.Object.create no longer supports defining methods that call _super.", !(typeof value === 'function' && value.toString().indexOf('._super') !== -1));
+
if (concatenatedProperties && indexOf(concatenatedProperties, keyName) >= 0) {
var baseValue = this[keyName];
@@ -10985,7 +10822,6 @@
metaForProperty: function(key) {
var desc = meta(this.proto(), false).descs[key];
- Ember.assert("metaForProperty() could not find a computed property with key '"+key+"'.", !!desc && desc instanceof Ember.ComputedProperty);
return desc._meta || {};
},
@@ -11191,7 +11027,7 @@
}
if (isNamespace) {
- Ember.deprecate("Namespaces should not begin with lowercase.", /^[A-Z]/.test(prop));
+
obj[NAME_KEY] = prop;
}
}
@@ -11408,7 +11244,6 @@
_contentDidChange: Ember.observer(function() {
var content = get(this, 'content');
- Ember.assert("Can't set ArrayProxy's content to itself", content !== this);
this._setupContent();
}, 'content'),
@@ -11438,7 +11273,6 @@
var arrangedContent = get(this, 'arrangedContent'),
len = arrangedContent ? get(arrangedContent, 'length') : 0;
- Ember.assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
this._setupArrangedContent();
@@ -11483,7 +11317,7 @@
_replace: function(idx, amt, objects) {
var content = get(this, 'content');
- Ember.assert('The content property of '+ this.constructor + ' should be set before modifying it', content);
+
if (content) this.replaceContent(idx, amt, objects);
return this;
},
@@ -11705,7 +11539,7 @@
*/
content: null,
_contentDidChange: Ember.observer(function() {
- Ember.assert("Can't set ObjectProxy's content to itself", this.get('content') !== this);
+
}, 'content'),
isTruthy: Ember.computed.bool('content'),
@@ -11733,7 +11567,7 @@
setUnknownProperty: function (key, value) {
var content = get(this, 'content');
- Ember.assert(fmt("Cannot delegate set('%@', %@) to the 'content' property of object proxy %@: its 'content' is undefined.", [key, value, this]), content);
+
return set(content, key, value);
}
});
@@ -12724,10 +12558,10 @@
var args = [].slice.call(arguments, 1), target;
if (this[actionName]) {
- Ember.assert("The controller " + this + " does not have the action " + actionName, typeof this[actionName] === 'function');
+
this[actionName].apply(this, args);
} else if(target = get(this, 'target')) {
- Ember.assert("The target for controller " + this + " (" + target + ") did not define a `send` method", typeof target.send === 'function');
+
target.send.apply(target, arguments);
}
}
@@ -12804,7 +12638,6 @@
sortProperties = get(this, 'sortProperties'),
sortAscending = get(this, 'sortAscending');
- Ember.assert("you need to define `sortProperties`", !!sortProperties);
forEach(sortProperties, function(propertyName) {
if (result === 0) {
@@ -13241,7 +13074,7 @@
*/
var jQuery = Ember.imports.jQuery;
-Ember.assert("Ember Views require jQuery 1.8, 1.9 or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(8|9))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
+
/**
Alias for jQuery
@@ -13385,7 +13218,7 @@
} else {
// Firefox versions < 11 do not have support for element.outerHTML.
var outerHTML = element.outerHTML || new XMLSerializer().serializeToString(element);
- Ember.assert("Can't set innerHTML on "+element.tagName+" in this browser", outerHTML);
+
var startTag = outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0],
endTag = '</'+tagName+'>';
@@ -14019,13 +13852,11 @@
var rootElement = Ember.$(get(this, 'rootElement'));
- Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));
- Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);
- Ember.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find('.ember-application').length);
+
+
rootElement.addClass('ember-application');
- Ember.assert('Unable to add "ember-application" class to rootElement. Make sure you set rootElement to the body or an element in the body.', rootElement.is('.ember-application'));
for (event in events) {
if (events.hasOwnProperty(event)) {
@@ -14233,7 +14064,7 @@
ret.replace = function (idx, removedCount, addedViews) {
if (view instanceof Ember.ContainerView) {
- Ember.deprecate("Manipulating an Ember.ContainerView through its childViews property is deprecated. Please use the ContainerView instance itself as an Ember.MutableArray.");
+
return view.replace(idx, removedCount, addedViews);
}
throw new Error("childViews is immutable");
@@ -14242,7 +14073,6 @@
return ret;
});
-Ember.warn("The VIEW_PRESERVES_CONTEXT flag has been removed and the functionality can no longer be disabled.", Ember.ENV.VIEW_PRESERVES_CONTEXT !== false);
/**
Global hash of shared templates. This will automatically be populated
@@ -15084,7 +14914,6 @@
var templateName = get(this, 'templateName'),
template = this.templateForName(templateName, 'template');
- Ember.assert("You specified the templateName " + templateName + " for " + this + ", but it did not exist.", !templateName || template);
return template || get(this, 'defaultTemplate');
}).property('templateName'),
@@ -15119,14 +14948,13 @@
var layoutName = get(this, 'layoutName'),
layout = this.templateForName(layoutName, 'layout');
- Ember.assert("You specified the layoutName " + layoutName + " for " + this + ", but it did not exist.", !layoutName || layout);
return layout || get(this, 'defaultLayout');
}).property('layoutName'),
templateForName: function(name, type) {
if (!name) { return; }
- Ember.assert("templateNames are not allowed to contain periods: "+name, name.indexOf('.') === -1);
+
var container = this.container || (Ember.Container && Ember.Container.defaultContainer);
return container && container.lookup('template:' + name);
},
@@ -15249,7 +15077,7 @@
@deprecated
*/
nearestInstanceOf: function(klass) {
- Ember.deprecate("nearestInstanceOf is deprecated and will be removed from future releases. Use nearestOfType.");
+
var view = get(this, 'parentView');
while (view) {
@@ -15383,7 +15211,6 @@
// is the view's controller by default. A hash of data is also passed that provides
// the template with access to the view and render buffer.
- Ember.assert('template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?', typeof template === 'function');
// The template should write directly to the render buffer instead
// of returning a string.
output = template(context, { data: data });
@@ -15654,7 +15481,7 @@
// Schedule the DOM element to be created and appended to the given
// element after bindings have synchronized.
this._insertElementLater(function() {
- Ember.assert("You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));
+
this.$().appendTo(target);
});
@@ -15675,7 +15502,7 @@
@return {Ember.View} received
*/
replaceIn: function(target) {
- Ember.assert("You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));
+
this._insertElementLater(function() {
Ember.$(target).empty();
@@ -16148,10 +15975,8 @@
// setup child views. be sure to clone the child views array first
this._childViews = this._childViews.slice();
- Ember.assert("Only arrays are allowed for 'classNameBindings'", Ember.typeOf(this.classNameBindings) === 'array');
this.classNameBindings = Ember.A(this.classNameBindings.slice());
- Ember.assert("Only arrays are allowed for 'classNames'", Ember.typeOf(this.classNames) === 'array');
this.classNames = Ember.A(this.classNames.slice());
var viewController = get(this, 'viewController');
@@ -16290,7 +16115,7 @@
// consumers of the view API
if (view.viewName) { set(get(this, 'concreteView'), view.viewName, view); }
} else {
- Ember.assert('You must pass instance or subclass of View', view.isView);
+
if (attrs) {
view.setProperties(attrs);
@@ -16809,7 +16634,7 @@
},
empty: function() {
- Ember.assert("Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications.");
+
},
renderToBufferIfNeeded: function (view, buffer) {
@@ -16936,7 +16761,7 @@
// Register the view for event handling. This hash is used by
// Ember.EventDispatcher to dispatch incoming events.
if (!view.isVirtual) {
- Ember.assert("Attempted to register a view with an id already in use: "+view.elementId, !Ember.View.views[view.elementId]);
+
Ember.View.views[view.elementId] = view;
}
@@ -17672,7 +17497,7 @@
var content = get(this, 'content');
if (content) {
- Ember.assert(fmt("an Ember.CollectionView's content must implement Ember.Array. You passed %@", [content]), Ember.Array.detect(content));
+
content.addArrayObserver(this);
}
@@ -17744,7 +17569,6 @@
itemViewClass = get(itemViewClass);
}
- Ember.assert(fmt("itemViewClass must be a subclass of Ember.View, not %@", [itemViewClass]), Ember.View.detect(itemViewClass));
len = content ? get(content, 'length') : 0;
if (len) {
@@ -18372,7 +18196,6 @@
Handlebars = require('handlebars');
}
-Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars && Handlebars.COMPILER_REVISION === 2);
/**
Prepares the Handlebars templating library for use inside Ember's view
@@ -18393,7 +18216,7 @@
Ember.Handlebars.helper = function(name, value) {
if (Ember.View.detect(value)) {
Ember.Handlebars.registerHelper(name, function(name, options) {
- Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3);
+
return Ember.Handlebars.helpers.view.call(this, value, options);
});
} else {
@@ -18836,7 +18659,6 @@
return evaluateMultiPropertyBoundHelper(currentContext, fn, normalizedProperties, options);
}
- Ember.assert("Dependent keys can only be used with single-property helpers.", properties.length === 1);
normalized = normalizedProperties[0];
@@ -19111,7 +18933,7 @@
init: function() {
this._super();
this.morph = Metamorph();
- Ember.deprecate('Supplying a tagName to Metamorph views is unreliable and is deprecated. You may be setting the tagName on a Handlebars helper that creates a Metamorph.', !this.tagName);
+
},
beforeRender: function(buffer) {
@@ -19634,7 +19456,7 @@
@return {String} HTML string
*/
EmberHandlebars.registerHelper('_triageMustache', function(property, fn) {
- Ember.assert("You cannot pass more than one argument to the _triageMustache helper", arguments.length <= 2);
+
if (helpers[property]) {
return helpers[property].call(this, fn);
}
@@ -19668,7 +19490,7 @@
@return {String} HTML string
*/
EmberHandlebars.registerHelper('bind', function(property, options) {
- Ember.assert("You cannot pass more than one argument to the bind helper", arguments.length <= 2);
+
var context = (options.contexts && options.contexts[0]) || this;
@@ -19724,12 +19546,10 @@
if (arguments.length === 4) {
var keywordName, path, rootPath, normalized;
- Ember.assert("If you pass more than one argument to the with helper, it must be in the form #with foo as bar", arguments[1] === "as");
options = arguments[3];
keywordName = arguments[2];
path = arguments[0];
- Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
if (Ember.isGlobalPath(path)) {
Ember.bind(options.data.keywords, keywordName, path);
@@ -19750,8 +19570,8 @@
return bind.call(this, path, options, true, exists);
} else {
- Ember.assert("You must pass exactly one argument to the with helper", arguments.length === 2);
- Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+
return helpers.bind.call(options.contexts[0], context, options);
}
});
@@ -19767,8 +19587,8 @@
@return {String} HTML string
*/
EmberHandlebars.registerHelper('if', function(context, options) {
- Ember.assert("You must pass exactly one argument to the if helper", arguments.length === 2);
- Ember.assert("You must pass a block to the if helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+
return helpers.boundIf.call(options.contexts[0], context, options);
});
@@ -19781,8 +19601,8 @@
@return {String} HTML string
*/
EmberHandlebars.registerHelper('unless', function(context, options) {
- Ember.assert("You must pass exactly one argument to the unless helper", arguments.length === 2);
- Ember.assert("You must pass a block to the unless helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+
var fn = options.fn, inverse = options.inverse;
@@ -19919,7 +19739,6 @@
var attrs = options.hash;
- Ember.assert("You must specify at least one hash argument to bindAttr", !!Ember.keys(attrs).length);
var view = options.data.view;
var ret = [];
@@ -19947,21 +19766,18 @@
var path = attrs[attr],
normalized;
- Ember.assert(fmt("You must provide a String for a bound attribute, not %@", [path]), typeof path === 'string');
normalized = normalizePath(ctx, path, options.data);
var value = (path === 'this') ? normalized.root : handlebarsGet(ctx, path, options),
type = Ember.typeOf(value);
- Ember.assert(fmt("Attributes must be numbers, strings or booleans, not %@", [value]), value === null || value === undefined || type === 'number' || type === 'string' || type === 'boolean');
var observer, invoker;
observer = function observer() {
var result = handlebarsGet(ctx, path, options);
- Ember.assert(fmt("Attributes must be numbers, strings or booleans, not %@", [result]), result === null || result === undefined || typeof result === 'number' || typeof result === 'string' || typeof result === 'boolean');
var elem = view.$("[data-bindattr-" + dataId + "='" + dataId + "']");
@@ -20170,7 +19986,7 @@
}
if (hash.attributeBindings) {
- Ember.assert("Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.");
+
extensions.attributeBindings = null;
dup = true;
}
@@ -20245,12 +20061,11 @@
if ('string' === typeof path) {
newView = EmberHandlebars.get(thisContext, path, options);
- Ember.assert("Unable to find view at path '" + path + "'", !!newView);
+
} else {
newView = path;
}
- Ember.assert(Ember.String.fmt('You must pass a view to the #view helper, not %@ (%@)', [path, newView]), Ember.View.detect(newView) || Ember.View.detectInstance(newView));
var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
var currentView = data.view;
@@ -20258,7 +20073,7 @@
var newViewProto = newView.proto ? newView.proto() : newView;
if (fn) {
- Ember.assert("You cannot provide a template block if you also specified a templateName", !get(viewOptions, 'templateName') && !get(newViewProto, 'templateName'));
+
viewOptions.template = fn;
}
@@ -20438,7 +20253,7 @@
@return {String} HTML string
*/
EmberHandlebars.registerHelper('view', function(path, options) {
- Ember.assert("The view helper only takes a single argument", arguments.length <= 2);
+
// If no path is provided, treat path param as options.
if (path && path.data && path.data.isRenderData) {
@@ -20588,15 +20403,15 @@
@deprecated Use `{{each}}` helper instead.
*/
Ember.Handlebars.registerHelper('collection', function(path, options) {
- Ember.deprecate("Using the {{collection}} helper without specifying a class has been deprecated as the {{each}} helper now supports the same functionality.", path !== 'collection');
+
// If no path is provided, treat path param as options.
if (path && path.data && path.data.isRenderData) {
options = path;
path = undefined;
- Ember.assert("You cannot pass more than one argument to the collection helper", arguments.length === 1);
+
} else {
- Ember.assert("You cannot pass more than one argument to the collection helper", arguments.length === 2);
+
}
var fn = options.fn;
@@ -20608,7 +20423,7 @@
// Otherwise, just default to the standard class.
var collectionClass;
collectionClass = path ? handlebarsGet(this, path, options) : Ember.CollectionView;
- Ember.assert(fmt("%@ #collection: Could not find collection class %@", [data.view, path]), !!collectionClass);
+
var hash = options.hash, itemHash = {}, match;
@@ -20617,7 +20432,7 @@
var collectionPrototype = collectionClass.proto();
delete hash.itemViewClass;
itemViewClass = itemViewPath ? handlebarsGet(collectionPrototype, itemViewPath, options) : collectionPrototype.itemViewClass;
- Ember.assert(fmt("%@ #collection: Could not find itemViewClass %@", [data.view, itemViewPath]), !!itemViewClass);
+
// Go through options passed to the {{collection}} helper and extract options
// that configure item views instead of the collection itself.
@@ -21067,7 +20882,7 @@
*/
Ember.Handlebars.registerHelper('each', function(path, options) {
if (arguments.length === 4) {
- Ember.assert("If you pass more than one argument to the each helper, it must be in the form #each foo in bar", arguments[1] === "in");
+
var keywordName = arguments[0];
@@ -21146,7 +20961,6 @@
var view = options.data.view,
template = view.templateForName(name);
- Ember.assert("Unable to find template with name '"+name+"'.", !!template);
template(this, { data: options.data });
});
@@ -21198,8 +21012,7 @@
template = view.templateForName(underscoredName),
deprecatedTemplate = view.templateForName(name);
- Ember.deprecate("You tried to render the partial " + name + ", which should be at '" + underscoredName + "', but Ember found '" + name + "'. Please use a leading underscore in your partials", template);
- Ember.assert("Unable to find partial with name '"+name+"'.", template || deprecatedTemplate);
+
template = template || deprecatedTemplate;
@@ -21276,7 +21089,6 @@
view = get(view, 'parentView');
}
- Ember.assert("You called yield in a template that was not a layout", !!view);
template = get(view, 'template');
@@ -21713,7 +21525,7 @@
},
init: function() {
- Ember.deprecate("Ember.Button is deprecated and will be removed from future releases. Consider using the `{{action}}` helper.");
+
this._super();
}
});
@@ -22380,7 +22192,7 @@
}
Ember.Handlebars.registerHelper('input', function(options) {
- Ember.assert('You can only pass attributes to the `input` helper, not arguments', arguments.length < 2);
+
var hash = options.hash,
types = options.hashTypes,
@@ -22402,7 +22214,7 @@
});
Ember.Handlebars.registerHelper('textarea', function(options) {
- Ember.assert('You can only pass attributes to the `textarea` helper, not arguments', arguments.length < 2);
+
var hash = options.hash,
types = options.hashTypes;
@@ -23676,7 +23488,7 @@
},
route: function(name, options) {
- Ember.assert("You must use `this.resource` to nest", typeof options !== 'function');
+
options = options || {};
@@ -23988,7 +23800,6 @@
name = passedName;
}
- Ember.assert("The route " + passedName + " was not found", router.router.hasRoute(name));
router.router[method].apply(router.router, args);
router.notifyPropertyChange('url');
@@ -24209,14 +24020,14 @@
}
if (this.setupControllers) {
- Ember.deprecate("Ember.Route.setupControllers is deprecated. Please use Ember.Route.setupController(controller, model) instead.");
+
this.setupControllers(controller, context);
} else {
this.setupController(controller, context);
}
if (this.renderTemplates) {
- Ember.deprecate("Ember.Route.renderTemplates is deprecated. Please use Ember.Route.renderTemplate(controller, model) instead.");
+
this.renderTemplates(context);
} else {
this.renderTemplate(controller, context);
@@ -24305,7 +24116,6 @@
namespace = this.router.namespace,
modelClass = namespace[className];
- Ember.assert("You used the dynamic segment " + name + "_id in your router, but " + namespace + "." + className + " did not exist and you did not override your route's `model` hook.", modelClass);
return modelClass.find(value);
},
@@ -24415,7 +24225,6 @@
if (!controller) {
model = model || this.modelFor(name);
- Ember.assert("You are trying to look up a controller that you did not define, and for which Ember does not know the model.\n\nThis is not a controller for a route, so you must explicitly define the controller ("+this.router.namespace.toString() + "." + Ember.String.capitalize(Ember.String.camelize(name))+"Controller) or pass a model as the second parameter to `controllerFor`, so that Ember knows which type of controller to create for you.", model || this.container.lookup('route:' + name));
controller = Ember.generateController(container, name, model);
}
@@ -24508,7 +24317,7 @@
@param {Object} options the options
*/
render: function(name, options) {
- Ember.assert("The name in the given arguments is undefined", arguments.length > 0 ? !Ember.isNone(arguments[0]) : true);
+
if (typeof name === 'object' && !options) {
options = name;
@@ -24553,7 +24362,6 @@
if (!parent) { return; }
- Ember.warn(fmt("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected", get(parent, 'routeName'), get(route, 'routeName')), !isRecursive);
if (template = parent.lastRenderedTemplate) {
return template;
@@ -24569,7 +24377,6 @@
options.name = name;
options.template = template;
- Ember.assert("An outlet ("+options.outlet+") was specified but this view will render at the root level.", options.outlet === 'main' || options.into);
var controller = options.controller, namedController;
@@ -24709,7 +24516,6 @@
routeName = fullRouteName(router, passedRouteName);
- Ember.assert(fmt("The attempt to linkTo route '%@' failed. The router did not find '%@' in its possible routes: '%@'", [passedRouteName, passedRouteName, Ember.keys(router.router.recognizer.names).join("', '")]), router.hasRoute(routeName));
var ret = [ routeName ];
return ret.concat(resolvedPaths(linkView.parameters));
@@ -25070,7 +24876,7 @@
@param {Hash} options
*/
Ember.Handlebars.registerHelper('render', function(name, contextString, options) {
- Ember.assert("You must pass a template to render", arguments.length >= 2);
+
var container, router, controller, view, context, lookupOptions;
if (arguments.length === 2) {
@@ -25087,7 +24893,6 @@
container = options.data.keywords.controller.container;
router = container.lookup('router:main');
- Ember.assert("You can only use the {{render}} helper once without a model object as its second argument, as in {{render \"post\" post}}.", context || !router || !router._lookupActiveView(name));
view = container.lookup('view:' + name) || container.lookup('view:default');
@@ -25202,7 +25007,7 @@
if (target.send) {
target.send.apply(target, args(options.parameters, actionName));
} else {
- Ember.assert("The action '" + actionName + "' did not exist on " + target, typeof target[actionName] === 'function');
+
target[actionName].apply(target, args(options.parameters));
}
});
@@ -25497,8 +25302,7 @@
childController = subContainer.lookup('controller:' + normalizedPath),
childTemplate = subContainer.lookup('template:' + path);
- Ember.assert("Could not find controller for path: " + normalizedPath, childController);
- Ember.assert("Could not find view for path: " + normalizedPath, childView);
+
set(childController, 'target', controller);
set(childController, 'model', model);
@@ -25575,7 +25379,7 @@
@method transitionTo
*/
transitionTo: function() {
- Ember.deprecate("transitionTo is deprecated. Please use transitionToRoute.");
+
return this.transitionToRoute.apply(this, arguments);
},
@@ -25592,7 +25396,7 @@
@method replaceWith
*/
replaceWith: function() {
- Ember.deprecate("replaceWith is deprecated. Please use replaceRoute.");
+
return this.replaceRoute.apply(this, arguments);
}
});
@@ -25683,10 +25487,10 @@
Ember.Location = {
create: function(options) {
var implementation = options && options.implementation;
- Ember.assert("Ember.Location.create: you must specify a 'implementation' option", !!implementation);
+
var implementationClass = this.implementations[implementation];
- Ember.assert("Ember.Location.create: " + implementation + " is not a valid implementation", !!implementationClass);
+
return implementationClass.create.apply(implementationClass, arguments);
},
@@ -26299,7 +26103,6 @@
var namespaceName = capitalize(parts.slice(0, -1).join('.'));
root = Ember.Namespace.byName(namespaceName);
- Ember.assert('You are looking for a ' + name + ' ' + type + ' in the ' + namespaceName + ' namespace, but the namespace could not be found', root);
}
return {
@@ -26616,11 +26419,11 @@
if ( Ember.LOG_VERSION ) {
Ember.LOG_VERSION = false; // we only need to see this once per Application#init
- Ember.debug('-------------------------------');
- Ember.debug('Ember.VERSION : ' + Ember.VERSION);
- Ember.debug('Handlebars.VERSION : ' + Ember.Handlebars.VERSION);
- Ember.debug('jQuery.VERSION : ' + Ember.$().jquery);
- Ember.debug('-------------------------------');
+
+
+
+
+
}
},
@@ -26723,7 +26526,7 @@
@method deferReadiness
*/
deferReadiness: function() {
- Ember.assert("You cannot defer readiness since the `ready()` hook has already been called.", this._readinessDeferrals > 0);
+
this._readinessDeferrals++;
},
@@ -26799,7 +26602,7 @@
@method initialize
**/
initialize: function(){
- Ember.deprecate('Calling initialize manually is not supported. Please see Ember.Application#advanceReadiness and Ember.Application#deferReadiness');
+
},
/**
@private
@@ -26830,7 +26633,7 @@
},
reset: function() {
- Ember.assert('App#reset no longer rneeds to be wrapped in a run-loop', !Ember.run.currentRunLoop);
+
Ember.run(this, function(){
Ember.run(get(this,'__container__'), 'destroy');
@@ -26864,7 +26667,7 @@
graph.topsort(function (vertex) {
var initializer = vertex.value;
- Ember.assert("No application initializer named '"+vertex.name+"'", initializer);
+
initializer(container, namespace);
});
},
@@ -26977,9 +26780,8 @@
initializer: function(initializer) {
var initializers = get(this, 'initializers');
- Ember.assert("The initializer '" + initializer.name + "' has already been registered", !initializers.findProperty('name', initializers.name));
- Ember.assert("An injection cannot be registered with both a before and an after", !(initializer.before && initializer.after));
- Ember.assert("An injection cannot be registered without an injection function", Ember.canInvoke(initializer, 'initialize'));
+
+
initializers.push(initializer);
},
@@ -27137,7 +26939,7 @@
if (!container.has(dependency)) {
satisfied = false;
- Ember.assert(controller + " needs " + dependency + " but it does not exist", false);
+
}
}
@@ -27153,12 +26955,12 @@
// Structure asserts to still do verification but not string concat in production
if(!verifyDependencies(this)) {
- Ember.assert("Missing dependencies", false);
+
}
},
controllerFor: function(controllerName) {
- Ember.deprecate("Controller#controllerFor is deprecated, please use Controller#needs instead");
+
var container = get(this, 'container');
return container.lookup('controller:' + controllerName);
},
@@ -28124,7 +27926,7 @@
if (initialState) {
this.transitionTo(initialState);
- Ember.assert('Failed to transition to initial state "' + initialState + '"', !!get(this, 'currentState'));
+
}
},
@@ -28188,7 +27990,7 @@
send: function(event) {
var contexts = [].slice.call(arguments, 1);
- Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
+
return sendEvent.call(this, event, contexts, false);
},
unhandledEvent: function(manager, event) {
@@ -28346,7 +28148,7 @@
if (!resolveState) {
enterStates = this.getStatesInPath(this, path);
if (!enterStates) {
- Ember.assert('Could not find state for path: "'+path+'"');
+
return;
}
}
@@ -28402,7 +28204,6 @@
enterStates = transitions.enterStates,
transitionEvent = get(this, 'transitionEvent');
- Ember.assert("More contexts provided than states", offset >= 0);
arrayForEach.call(enterStates, function(state, idx) {
state.trigger(transitionEvent, this, contexts[idx-offset]);
@@ -28551,16 +28352,9 @@
})();
-// Version: v1.0.0-rc.3.1
-// Last commit: 1919625 (2013-07-25 18:13:08 -0400)
-
-
-(function() {
-/**
-Ember
-
-@module ember
-*/
-
-})();
-
+
+
+if (typeof location !== 'undefined' && (location.hostname === 'localhost' || location.hostname === '127.0.0.1')) {
+ console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. "+
+ "If you want full error messages please use the non-minified build provided on the Ember website.");
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment