dist/ember.js in ember-source-1.4.0.beta.5 vs dist/ember.js in ember-source-1.4.0.beta.6

- old
+ new

@@ -3,11 +3,11 @@ * @copyright Copyright 2011-2014 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 1.4.0-beta.5 + * @version 1.4.0-beta.6 */ (function() { /*global __fail__*/ @@ -207,11 +207,11 @@ * @copyright Copyright 2011-2014 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 1.4.0-beta.5 + * @version 1.4.0-beta.6 */ (function() { var define, requireModule, require, requirejs; @@ -290,11 +290,11 @@ The core Runtime framework is based on the jQuery API with a number of performance optimizations. @class Ember @static - @version 1.4.0-beta.5 + @version 1.4.0-beta.6 */ 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. @@ -317,14 +317,14 @@ /** @property VERSION @type String - @default '1.4.0-beta.5' + @default '1.4.0-beta.6' @static */ -Ember.VERSION = '1.4.0-beta.5'; +Ember.VERSION = '1.4.0-beta.6'; /** Standard environmental variables. You can define these in a global `EmberENV` variable before loading Ember to control various configuration settings. @@ -25850,15 +25850,15 @@ a template. If you name a template `components/my-foo`, you will be able to use `{{my-foo}}` in other templates, which will make an instance of the isolated component. - ```html + ```handlebars {{app-profile person=currentUser}} ``` - ```html + ```handlebars <!-- app-profile template --> <h1>{{person.title}}</h1> <img {{bind-attr src=person.avatar}}> <p class='signature'>{{person.signature}}</p> ``` @@ -25901,11 +25901,11 @@ }); ``` And then use it in the component's template: - ```html + ```handlebars <!-- app-profile template --> <h1>{{person.title}}</h1> {{yield}} <!-- block contents --> @@ -27074,10 +27074,37 @@ return value; }; +/** + This method uses `Ember.Handlebars.get` to lookup a value, then ensures + that the value is escaped properly. + + If `unescaped` is a truthy value then the escaping will not be performed. + + @method getEscaped + @for Ember.Handlebars + @param {Object} root The object to look up the property on + @param {String} path The path to be lookedup + @param {Object} options The template's option hash +*/ +Ember.Handlebars.getEscaped = function(root, path, options) { + var result = handlebarsGet(root, path, options); + + if (result === null || result === undefined) { + result = ""; + } else if (!(result instanceof Handlebars.SafeString)) { + result = String(result); + } + if (!options.hash.unescaped){ + result = Handlebars.Utils.escapeExpression(result); + } + + return result; +}; + Ember.Handlebars.resolveParams = function(context, params, options) { var resolvedParams = [], types = options.types, param, type; for (var i=0, l=params.length; i<l; i++) { param = params[i]; @@ -28043,33 +28070,20 @@ @submodule ember-handlebars */ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt; var handlebarsGet = Ember.Handlebars.get, normalizePath = Ember.Handlebars.normalizePath; +var handlebarsGetEscaped = Ember.Handlebars.getEscaped; var forEach = Ember.ArrayPolyfills.forEach; var o_create = Ember.create; var EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers; function exists(value) { return !Ember.isNone(value); } -function sanitizedHandlebarsGet(currentContext, property, options) { - var result = handlebarsGet(currentContext, property, options); - if (result === null || result === undefined) { - result = ""; - } else if (!(result instanceof Handlebars.SafeString)) { - result = String(result); - } - if (!options.hash.unescaped){ - result = Handlebars.Utils.escapeExpression(result); - } - - return result; -} - // Binds a property into the DOM. This will create a hook in DOM that the // KVO system will look for and update if the property changes. function bind(property, options, preserveContext, shouldDisplay, valueNormalizer, childProperties) { var data = options.data, fn = options.fn, @@ -28146,11 +28160,11 @@ } } } else { // The object is not observable, so just render it out and // be done with it. - data.buffer.push(handlebarsGet(currentContext, property, options)); + data.buffer.push(handlebarsGetEscaped(currentContext, property, options)); } } EmberHandlebars.bind = bind; @@ -28167,11 +28181,11 @@ if (data.insideGroup) { observer = function() { Ember.run.once(view, 'rerender'); }; - output = sanitizedHandlebarsGet(currentContext, property, options); + output = handlebarsGetEscaped(currentContext, property, options); data.buffer.push(output); } else { var bindView = new Ember._SimpleHandlebarsView( property, currentContext, !options.hash.unescaped, options.data @@ -28193,12 +28207,11 @@ view.registerObserver(normalized.root, normalized.path, observer); } } else { // The object is not observable, so just render it out and // be done with it. - output = sanitizedHandlebarsGet(currentContext, property, options); - + output = handlebarsGetEscaped(currentContext, property, options); data.buffer.push(output); } } function shouldDisplayIfHelperContent(result) { @@ -31522,10 +31535,11 @@ delete hash.type; delete hash.on; if (inputType === 'checkbox') { + Ember.assert("{{input type='checkbox'}} does not support setting `value=someBooleanValue`; you must use `checked=someBooleanValue` instead.", options.hashTypes.value !== 'ID'); return Ember.Handlebars.helpers.view.call(this, Ember.Checkbox, options); } else { if (inputType) { hash.type = inputType; } hash.onEvent = onEvent || 'enter'; return Ember.Handlebars.helpers.view.call(this, Ember.TextField, options); @@ -37323,11 +37337,11 @@ var linkType = options.types.shift(); var context = this; if (linkType === 'ID') { options.linkTextPath = linkTitle; options.fn = function() { - return Ember.Handlebars.get(context, linkTitle, options); + return Ember.Handlebars.getEscaped(context, linkTitle, options); }; } else { options.fn = function() { return linkTitle; }; @@ -38413,11 +38427,31 @@ Ember.deprecate('Using the Ember.Location.registerImplementation is no longer supported. Register your custom location implementation with the container instead.', false); this.implementations[name] = implementation; }, - implementations: {} + implementations: {}, + + /** + Returns the current `location.hash` by parsing location.href since browsers + inconsistently URL-decode `location.hash`. + + https://bugzilla.mozilla.org/show_bug.cgi?id=483304 + + @private + @method getHash + */ + getHash: function () { + var href = window.location.href, + hashIndex = href.indexOf('#'); + + if (hashIndex === -1) { + return ''; + } else { + return href.substr(hashIndex); + } + } }; })(); @@ -38520,11 +38554,12 @@ /** @module ember @submodule ember-routing */ -var get = Ember.get, set = Ember.set; +var get = Ember.get, set = Ember.set, + getHash = Ember.Location.getHash; /** `Ember.HashLocation` implements the location API using the browser's hash. At present, it relies on a `hashchange` event existing in the browser. @@ -38545,12 +38580,11 @@ @private @method getURL */ getURL: function() { - // Default implementation without feature flag enabled - return get(this, 'location').hash.substr(1); + return getHash().substr(1); }, /** Set the `location.hash` and remembers what was set. This prevents `onUpdateURL` callbacks from triggering when the hash was set by @@ -38591,10 +38625,10 @@ var self = this; var guid = Ember.guidFor(this); Ember.$(window).on('hashchange.ember-location-'+guid, function() { Ember.run(function() { - var path = location.hash.substr(1); + var path = self.getURL(); if (get(self, 'lastSetURL') === path) { return; } set(self, 'lastSetURL', null); callback(path);