dist/ember.js in ember-source-1.2.1.1 vs dist/ember.js in ember-source-1.2.2

- old
+ new

@@ -6,11 +6,11 @@ // License: Licensed under MIT license // See https://raw.github.com/emberjs/ember.js/master/LICENSE // ========================================================================== - // Version: 1.2.1 + // Version: 1.2.2 (function() { /*global __fail__*/ /** @@ -192,11 +192,11 @@ // License: Licensed under MIT license // See https://raw.github.com/emberjs/ember.js/master/LICENSE // ========================================================================== - // Version: 1.2.1 + // Version: 1.2.2 (function() { var define, requireModule; (function() { @@ -257,11 +257,11 @@ The core Runtime framework is based on the jQuery API with a number of performance optimizations. @class Ember @static - @version 1.2.1 + @version 1.2.2 */ 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. @@ -284,14 +284,14 @@ /** @property VERSION @type String - @default '1.2.1' + @default '1.2.2' @final */ -Ember.VERSION = '1.2.1'; +Ember.VERSION = '1.2.2'; /** Standard environmental variables. You can define these in a global `ENV` variable before loading Ember to control various configuration settings. @@ -24565,10 +24565,37 @@ value = Ember.get(Ember.lookup, path); } 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]; @@ -25510,32 +25537,19 @@ @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 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, @@ -25602,11 +25616,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; @@ -25623,11 +25637,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 @@ -25649,12 +25663,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); } } /** @@ -34086,10 +34099,10 @@ 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; };