dist/ember-template-compiler.js in ember-source-1.11.0.beta.5 vs dist/ember-template-compiler.js in ember-source-1.11.0

- old
+ new

@@ -3,11 +3,11 @@ * @copyright Copyright 2011-2015 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.11.0-beta.5.1501308c + * @version 1.11.0 */ (function() { var enifed, requireModule, eriuqer, requirejs, Ember; var mainContext = this; @@ -131,11 +131,11 @@ The core Runtime framework is based on the jQuery API with a number of performance optimizations. @class Ember @static - @version 1.11.0-beta.5.1501308c + @version 1.11.0 */ 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. @@ -159,14 +159,14 @@ /** @property VERSION @type String - @default '1.11.0-beta.5.1501308c' + @default '1.11.0' @static */ - Ember.VERSION = '1.11.0-beta.5.1501308c'; + Ember.VERSION = '1.11.0'; /** Standard environmental variables. You can define these in a global `EmberENV` variable before loading Ember to control various configuration settings. @@ -593,11 +593,11 @@ exports['default'] = function() { var disableComponentGeneration = true; return { - revision: 'Ember@1.11.0-beta.5.1501308c', + revision: 'Ember@1.11.0', disableComponentGeneration: disableComponentGeneration, plugins: plugins['default'] }; @@ -748,37 +748,11 @@ */ function compile(string, options) { return template(compileSpec(string, options)); } - __exports__.compile = compile;/* - * Compile a string into a template spec string. The template spec is a string - * representation of a template. Usually, you would use compileSpec for - * pre-compilation of a template on the server. - * - * Example usage: - * - * var templateSpec = compileSpec("Howdy {{name}}"); - * // This next step is basically what plain compile does - * var template = new Function("return " + templateSpec)(); - * - * @method compileSpec - * @param {String} string An htmlbars template string - * @return {Function} A template spec string - */ - function compileSpec(string, options) { - var ast = preprocess(string, options); - var compiler = new TemplateCompiler(options); - var program = compiler.compile(ast); - return program; - } - - __exports__.compileSpec = compileSpec;function template(program) { - return new Function("return " + program)(); - } - - __exports__.template = template; + __exports__.compile = compile; }); enifed("htmlbars-compiler/fragment-javascript-compiler", ["./utils","../htmlbars-util/quoting","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; @@ -1358,11 +1332,11 @@ this.paths.push(this.currentDOMChildIndex); this.currentDOMChildIndex = -1; forEach(element.attributes, this.attribute, this); - forEach(element.helpers, this.elementHelper, this); + forEach(element.modifiers, this.elementModifier, this); }; HydrationOpcodeCompiler.prototype.closeElement = function() { distributeMorphs(this.morphs, this.opcodes); this.opcode('popParent'); @@ -1465,12 +1439,12 @@ var attrMorphNum = this.attrMorphNum++; this.opcode('createAttrMorph', attrMorphNum, this.elementNum, attr.name, escaped, namespace); this.opcode('printAttributeHook', attrMorphNum, this.elementNum); }; - HydrationOpcodeCompiler.prototype.elementHelper = function(sexpr) { - prepareSexpr(this, sexpr); + HydrationOpcodeCompiler.prototype.elementModifier = function(modifier) { + prepareSexpr(this, modifier.sexpr); // If we have a helper in a node, and this element has not been cached, cache it if (this.element !== null) { this.opcode('shareElement', ++this.elementNum); this.element = null; // Reset element so we don't cache it more than once @@ -1579,11 +1553,11 @@ var processOpcodes = __dependency6__.processOpcodes; var repeat = __dependency7__.repeat; function TemplateCompiler(options) { this.options = options || {}; - this.revision = this.options.revision || "HTMLBars@v0.11.1"; + this.revision = this.options.revision || "HTMLBars@v0.11.2"; this.fragmentOpcodeCompiler = new FragmentOpcodeCompiler(); this.fragmentCompiler = new FragmentJavaScriptCompiler(); this.hydrationOpcodeCompiler = new HydrationOpcodeCompiler(); this.hydrationCompiler = new HydrationJavaScriptCompiler(); this.templates = []; @@ -1853,11 +1827,11 @@ var elementFrame = this.pushFrame(); elementFrame.parentNode = element; elementFrame.children = element.children; elementFrame.childCount = element.children.length; - elementFrame.mustacheCount += element.helpers.length; + elementFrame.mustacheCount += element.modifiers.length; elementFrame.blankChildTextNodes = []; var actionArgs = [ element, parentFrame.childIndex, @@ -2196,26 +2170,32 @@ type: "CommentStatement", value: value }; } - __exports__.buildComment = buildComment; - function buildConcat(parts) { + __exports__.buildComment = buildComment;function buildConcat(parts) { return { type: "ConcatStatement", parts: parts || [] }; } - __exports__.buildConcat = buildConcat;// Nodes + __exports__.buildConcat = buildConcat;function buildElementModifier(sexpr) { + return { + type: "ElementModifierStatement", + sexpr: sexpr + }; + } - function buildElement(tag, attributes, helpers, children) { + __exports__.buildElementModifier = buildElementModifier;// Nodes + + function buildElement(tag, attributes, modifiers, children) { return { type: "ElementNode", tag: tag, attributes: attributes || [], - helpers: helpers || [], + modifiers: modifiers || [], children: children || [] }; } __exports__.buildElement = buildElement;function buildComponent(tag, attributes, program) { @@ -2314,10 +2294,11 @@ mustache: buildMustache, block: buildBlock, partial: buildPartial, comment: buildComment, element: buildElement, + elementModifier: buildElementModifier, component: buildComponent, attr: buildAttr, text: buildText, sexpr: buildSexpr, path: buildPath, @@ -3875,11 +3856,11 @@ var text = buildText(token.chars); appendChild(current, text); }, StartTag: function(tag) { - var element = buildElement(tag.tagName, tag.attributes, tag.helpers || [], []); + var element = buildElement(tag.tagName, tag.attributes, tag.modifiers || [], []); element.loc = { start: { line: tag.firstLine, column: tag.firstColumn}, end: { line: null, column: null} }; @@ -3901,24 +3882,24 @@ var tokenizer = this.tokenizer; switch(tokenizer.state) { // Tag helpers case "tagName": - tokenizer.addTagHelper(mustache.sexpr); + tokenizer.addElementModifier(mustache); tokenizer.state = "beforeAttributeName"; return; case "beforeAttributeName": - tokenizer.addTagHelper(mustache.sexpr); + tokenizer.addElementModifier(mustache); return; case "attributeName": case "afterAttributeName": tokenizer.finalizeAttributeValue(); - tokenizer.addTagHelper(mustache.sexpr); + tokenizer.addElementModifier(mustache); tokenizer.state = "beforeAttributeName"; return; case "afterAttributeValueQuoted": - tokenizer.addTagHelper(mustache.sexpr); + tokenizer.addElementModifier(mustache); tokenizer.state = "beforeAttributeName"; return; // Attribute values case "beforeAttributeValue": @@ -4041,12 +4022,16 @@ delete this.currentAttribute.quoted; delete this.currentAttribute; } }; - Tokenizer.prototype.addTagHelper = function(helper) { - var helpers = this.token.helpers = this.token.helpers || []; - helpers.push(helper); + Tokenizer.prototype.addElementModifier = function(mustache) { + if (!this.token.modifiers) { + this.token.modifiers = []; + } + + var modifier = builders.elementModifier(mustache.sexpr); + this.token.modifiers.push(modifier); }; function prepareAttributeValue(attr) { var parts = attr.value; var length = parts.length; \ No newline at end of file