dist/ember.prod.js in ember-source-1.4.0.beta.5 vs dist/ember.prod.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() { var define, requireModule, require, requirejs; @@ -86,11 +86,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. @@ -113,14 +113,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. @@ -25561,15 +25561,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> ``` @@ -25612,11 +25612,11 @@ }); ``` And then use it in the component's template: - ```html + ```handlebars <!-- app-profile template --> <h1>{{person.title}}</h1> {{yield}} <!-- block contents --> @@ -26767,10 +26767,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]; @@ -27729,33 +27756,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, @@ -27832,11 +27846,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; @@ -27853,11 +27867,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 @@ -27879,12 +27893,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) { @@ -31157,11 +31170,11 @@ delete hash.type; delete hash.on; if (inputType === 'checkbox') { - return Ember.Handlebars.helpers.view.call(this, Ember.Checkbox, options); + 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); } @@ -36929,11 +36942,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; }; @@ -38005,11 +38018,31 @@ registerImplementation: function(name, implementation) { 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); + } + } }; })(); @@ -38112,11 +38145,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. @@ -38137,12 +38171,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 @@ -38183,10 +38216,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);