dist/ember.js in ember-source-1.0.0.rc4 vs dist/ember.js in ember-source-1.0.0.rc4.1

- old
+ new

@@ -1,7 +1,7 @@ -// Version: v1.0.0-rc4 -// Last commit: ae2e55f (2013-05-27 19:34:11 -0400) +// Version: v1.0.0-rc.4-2-g7f3974d +// Last commit: 7f3974d (2013-07-25 20:17:33 -0400) (function() { /*global __fail__*/ @@ -149,12 +149,12 @@ }; }; })(); -// Version: v1.0.0-rc4 -// Last commit: ae2e55f (2013-05-27 19:34:11 -0400) +// Version: v1.0.0-rc.4-2-g7f3974d +// Last commit: 7f3974d (2013-07-25 20:17:33 -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-rc4 + @version 1.0.0-rc.4 */ 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-rc4' + @default '1.0.0-rc.4' @final */ -Ember.VERSION = '1.0.0-rc4'; +Ember.VERSION = '1.0.0-rc.4'; /** Standard environmental variables. You can define these in a global `ENV` variable before loading Ember to control various configuration settings. @@ -14089,10 +14089,49 @@ 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 = { + "<": "&lt;", + ">": "&gt;", + '"': "&quot;", + "'": "&#x27;", + "`": "&#x60;" + }; + + var escapeChar = function(chr) { + return escape[chr] || "&amp;"; + }; + + 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. @@ -14376,27 +14415,27 @@ attrs = this.elementAttributes, props = this.elementProperties, style = this.elementStyle, attr, prop; - buffer += '<' + tagName; + buffer += '<' + stripTagName(tagName); if (id) { - buffer += ' id="' + this._escapeAttribute(id) + '"'; + buffer += ' id="' + escapeAttribute(id) + '"'; this.elementId = null; } if (classes) { - buffer += ' class="' + this._escapeAttribute(classes.join(' ')) + '"'; + buffer += ' class="' + escapeAttribute(classes.join(' ')) + '"'; this.classes = null; } if (style) { buffer += ' style="'; for (prop in style) { if (style.hasOwnProperty(prop)) { - buffer += prop + ':' + this._escapeAttribute(style[prop]) + ';'; + buffer += prop + ':' + escapeAttribute(style[prop]) + ';'; } } buffer += '"'; @@ -14404,11 +14443,11 @@ } if (attrs) { for (attr in attrs) { if (attrs.hasOwnProperty(attr)) { - buffer += ' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"'; + buffer += ' ' + attr + '="' + escapeAttribute(attrs[attr]) + '"'; } } this.elementAttributes = null; } @@ -14419,11 +14458,11 @@ var value = props[prop]; if (value || typeof(value) === 'number') { if (value === true) { buffer += ' ' + prop + '="' + prop + '"'; } else { - buffer += ' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"'; + buffer += ' ' + prop + '="' + escapeAttribute(props[prop]) + '"'; } } } } @@ -14434,11 +14473,11 @@ this.buffer = buffer; }, pushClosingTag: function() { var tagName = this.tagNames.pop(); - if (tagName) { this.buffer += '</' + tagName + '>'; } + if (tagName) { this.buffer += '</' + stripTagName(tagName) + '>'; } }, currentTagName: function() { return this.tagNames[this.tagNames.length-1]; }, @@ -14532,36 +14571,11 @@ } }, innerString: function() { return this.buffer; - }, - - _escapeAttribute: function(value) { - // Stolen shamelessly from Handlebars - - var escape = { - "<": "&lt;", - ">": "&gt;", - '"': "&quot;", - "'": "&#x27;", - "`": "&#x60;" - }; - - var badChars = /&(?!\w+;)|[<>"'`]/g; - var possible = /[&<>"'`]/; - - var escapeChar = function(chr) { - return escape[chr] || "&amp;"; - }; - - var string = value.toString(); - - if(!possible.test(string)) { return string; } - return string.replace(badChars, escapeChar); } - }; })(); @@ -29911,11 +29925,11 @@ })(); })(); -// Version: v1.0.0-rc4 -// Last commit: ae2e55f (2013-05-27 19:34:11 -0400) +// Version: v1.0.0-rc.4-2-g7f3974d +// Last commit: 7f3974d (2013-07-25 20:17:33 -0400) (function() { /** Ember