Socket
Socket
Sign inDemoInstall

htmlbars

Package Overview
Dependencies
Maintainers
5
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlbars - npm Package Compare versions

Comparing version 0.13.34 to 0.13.35

84

dist/amd/dom-helper.amd.js

@@ -5,7 +5,7 @@ define('dom-helper', ['exports', './htmlbars-runtime/morph', './morph-attr', './dom-helper/build-html-dom', './dom-helper/classes', './dom-helper/prop'], function (exports, Morph, AttrMorph, build_html_dom, classes, prop) {

var doc = typeof document === "undefined" ? false : document;
var doc = typeof document === 'undefined' ? false : document;
var deletesBlankTextNodes = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(""));
var element = document.createElement('div');
element.appendChild(document.createTextNode(''));
var clonedElement = element.cloneNode(true);

@@ -16,4 +16,4 @@ return clonedElement.childNodes.length === 0;

var ignoresCheckedAttribute = doc && (function (document) {
var element = document.createElement("input");
element.setAttribute("checked", "checked");
var element = document.createElement('input');
element.setAttribute('checked', 'checked');
var clonedElement = element.cloneNode(false);

@@ -24,14 +24,14 @@ return !clonedElement.checked;

var canRemoveSvgViewBoxAttribute = doc && (doc.createElementNS ? (function (document) {
var element = document.createElementNS(build_html_dom.svgNamespace, "svg");
element.setAttribute("viewBox", "0 0 100 100");
element.removeAttribute("viewBox");
return !element.getAttribute("viewBox");
var element = document.createElementNS(build_html_dom.svgNamespace, 'svg');
element.setAttribute('viewBox', '0 0 100 100');
element.removeAttribute('viewBox');
return !element.getAttribute('viewBox');
})(doc) : true);
var canClone = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(" "));
element.appendChild(document.createTextNode(" "));
var element = document.createElement('div');
element.appendChild(document.createTextNode(' '));
element.appendChild(document.createTextNode(' '));
var clonedElement = element.cloneNode(true);
return clonedElement.childNodes[0].nodeValue === " ";
return clonedElement.childNodes[0].nodeValue === ' ';
})(doc);

@@ -77,3 +77,3 @@

// Omitted start tags are only inside table tags.
if (contextualElement.tagName === "TABLE") {
if (contextualElement.tagName === 'TABLE') {
var omittedStartTagChildMatch = omittedStartTagChildTest.exec(string);

@@ -84,3 +84,3 @@ if (omittedStartTagChildMatch) {

// and not the proper start tag. Just see if a tag was omitted.
return omittedStartTagChild === "tr" || omittedStartTagChild === "col";
return omittedStartTagChild === 'tr' || omittedStartTagChild === 'col';
}

@@ -91,4 +91,4 @@ }

function buildSVGDOM(html, dom) {
var div = dom.document.createElement("div");
div.innerHTML = "<svg>" + html + "</svg>";
var div = dom.document.createElement('div');
div.innerHTML = '<svg>' + html + '</svg>';
return div.firstChild.childNodes;

@@ -248,3 +248,3 @@ }

prototype.removeAttribute = function (element, name) {
if (element.tagName === "svg" && name === "viewBox") {
if (element.tagName === 'svg' && name === 'viewBox') {
element.setAttribute(name, null);

@@ -262,4 +262,4 @@ } else {

if (value === null && (name === "value" || name === "type" || name === "src")) {
value = "";
if (value === null && (name === 'value' || name === 'type' || name === 'src')) {
value = '';
}

@@ -276,3 +276,3 @@

var lowercaseName = name.toLowerCase();
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === "style") {
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === 'style') {
if (prop.isAttrRemovalValue(value)) {

@@ -293,3 +293,3 @@ element.removeAttribute(name);

if (type === "prop") {
if (type === 'prop') {
element[normalized] = value;

@@ -316,3 +316,3 @@ } else {

if (contextualElement) {
if (tagName === "svg") {
if (tagName === 'svg') {
namespace = build_html_dom.svgNamespace;

@@ -367,3 +367,3 @@ } else {

for (var i = 0, len = blankChildTextNodes.length; i < len; i++) {
var textNode = this.document.createTextNode(""),
var textNode = this.document.createTextNode(''),
offset = blankChildTextNodes[i],

@@ -379,3 +379,3 @@ before = this.childAtIndex(element, offset);

if (ignoresCheckedAttribute && isChecked) {
element.setAttribute("checked", "checked");
element.setAttribute('checked', 'checked');
}

@@ -436,3 +436,3 @@ };

if (!firstChild) {
var comment = this.createComment("");
var comment = this.createComment('');
this.appendChild(element, comment);

@@ -469,3 +469,3 @@ return Morph['default'].create(this, element, comment);

prototype.insertMorphBefore = function (element, referenceChild, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.insertBefore(insertion, referenceChild);

@@ -476,3 +476,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

prototype.appendMorph = function (element, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.appendChild(insertion);

@@ -485,3 +485,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

var child = index === null ? null : this.childAtIndex(fragment, index);
this.insertBefore(fragment, this.createTextNode(""), child);
this.insertBefore(fragment, this.createTextNode(''), child);
};

@@ -519,3 +519,3 @@

// related to auto-select behavior. Skip past it.
if (contextualElement.tagName === "SELECT") {
if (contextualElement.tagName === 'SELECT') {
currentNode = currentNode.nextSibling;

@@ -540,3 +540,3 @@ }

if (!parsingNode) {
parsingNode = this.document.createElement("a");
parsingNode = this.document.createElement('a');
}

@@ -569,3 +569,3 @@

var testEl = document.createElementNS(svgNamespace, 'title');
testEl.innerHTML = '<div></div>';
testEl.innerHTML = "<div></div>";
return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;

@@ -579,4 +579,4 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = '<div></div>';
testEl.firstChild.innerHTML = '<script></script>';
testEl.innerHTML = "<div></div>";
testEl.firstChild.innerHTML = "<script><\/script>";
return testEl.firstChild.innerHTML === '';

@@ -590,3 +590,3 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = 'Test: <script type=\'text/x-placeholder\'></script>Value';
testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value';

@@ -647,3 +647,3 @@ })(doc);

// At this point it's the actual unicode character.
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === '­') {
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
var newValue = shyElement.nodeValue.slice(1);

@@ -666,3 +666,3 @@ if (newValue.length) {

if (!outerHTML) {
throw 'Can\'t set innerHTML on ' + tagName + ' in this browser';
throw "Can't set innerHTML on " + tagName + " in this browser";
}

@@ -674,3 +674,3 @@

var startTag = outerHTML.match(new RegExp('<' + tagName + '([^>]*)>', 'i'))[0];
var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0];
var endTag = '</' + tagName + '>';

@@ -723,3 +723,3 @@

if (contextualElement.tagName === 'SELECT') {
html = '<option></option>' + html;
html = "<option></option>" + html;
}

@@ -955,2 +955,3 @@

*/
function normalizeProperty(element, slotName) {

@@ -1093,3 +1094,3 @@ var type, normalized;

if (element.namespaceURI === build_html_dom.svgNamespace || attrName === "style" || type === "attr") {
if (element.namespaceURI === build_html_dom.svgNamespace || attrName === 'style' || type === 'attr') {
this._update = updateAttribute;

@@ -1177,2 +1178,3 @@ this._get = getAttribute;

};
function sanitizeAttributeValue(dom, element, attribute, value) {

@@ -1569,3 +1571,3 @@ var tagName;

if (morph.parentMorphList !== this) {
throw new Error('Cannot remove a morph from a parent it is not inside of');
throw new Error("Cannot remove a morph from a parent it is not inside of");
}

@@ -1572,0 +1574,0 @@

@@ -36,3 +36,3 @@ define('htmlbars-test-helpers', ['exports', '../simple-html-tokenizer', '../htmlbars-util/array-utils'], function (exports, simple_html_tokenizer, array_utils) {

var div = document.createElement("div");
if (typeof fragmentOrHtml === "string") {
if (typeof fragmentOrHtml === 'string') {
div.innerHTML = fragmentOrHtml;

@@ -45,2 +45,3 @@ } else {

}
function equalTokens(fragment, html, message) {

@@ -58,3 +59,3 @@ if (fragment.fragment) {

function normalizeTokens(token) {
if (token.type === "StartTag") {
if (token.type === 'StartTag') {
token.attributes = token.attributes.sort(function (a, b) {

@@ -89,8 +90,9 @@ if (a[0] > b[0]) {

}
var div = document.createElement("div");
var node = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var div = document.createElement('div');
var node = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
div.appendChild(node);
var clone = div.cloneNode(true);
return clone.innerHTML === "<svg xmlns=\"http://www.w3.org/2000/svg\" />";
return clone.innerHTML === '<svg xmlns="http://www.w3.org/2000/svg" />';
})();
function normalizeInnerHTML(actualHTML) {

@@ -100,6 +102,6 @@ if (ieSVGInnerHTML) {

// drop namespace attribute
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, "");
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, '');
// replace self-closing elements
actualHTML = actualHTML.replace(/<([^ >]+) [^\/>]*\/>/gi, function (tag, tagName) {
return tag.slice(0, tag.length - 3) + "></" + tagName + ">";
return tag.slice(0, tag.length - 3) + '></' + tagName + '>';
});

@@ -112,5 +114,6 @@ }

// detect weird IE8 checked element string
var checkedInput = document.createElement("input");
checkedInput.setAttribute("checked", "checked");
var checkedInput = document.createElement('input');
checkedInput.setAttribute('checked', 'checked');
var checkedInputString = checkedInput.outerHTML;
function isCheckedInputHTML(element) {

@@ -121,3 +124,4 @@ equal(element.outerHTML, checkedInputString);

// check which property has the node's text content
var textProperty = document.createElement("div").textContent === undefined ? "innerText" : "textContent";
var textProperty = document.createElement('div').textContent === undefined ? 'innerText' : 'textContent';
function getTextContent(el) {

@@ -124,0 +128,0 @@ // textNode

@@ -109,3 +109,3 @@ define('htmlbars-util', ['exports', './htmlbars-util/safe-string', './htmlbars-util/handlebars/utils', './htmlbars-util/namespaces', './htmlbars-util/morph-utils'], function (exports, SafeString, utils, namespaces, morph_utils) {

'"': '&quot;',
'\'': '&#x27;',
"'": '&#x27;',
'`': '&#x60;'

@@ -120,2 +120,3 @@ };

}
function extend(obj /* , ...source */) {

@@ -310,2 +311,3 @@ for (var i = 1; i < arguments.length; i++) {

};
function getAttrNamespace(attrName) {

@@ -384,3 +386,3 @@ var namespace;

str = str.replace(/\\/g, "\\\\");
str = str.replace(/"/g, "\\\"");
str = str.replace(/"/g, '\\"');
str = str.replace(/\n/g, "\\n");

@@ -391,3 +393,3 @@ return str;

function string(str) {
return "\"" + escapeString(str) + "\"";
return '"' + escapeString(str) + '"';
}

@@ -491,3 +493,3 @@

}
if (typeof blocks === "function") {
if (typeof blocks === 'function') {
env.hooks.bindBlock(env, shadowScope, blocks);

@@ -502,2 +504,3 @@ } else {

}
function renderAndCleanup(morph, env, options, shadowOptions, callback) {

@@ -504,0 +507,0 @@ // The RenderState object is used to collect information about what the

@@ -5,7 +5,7 @@ define('dom-helper', ['exports', './htmlbars-runtime/morph', './morph-attr', './dom-helper/build-html-dom', './dom-helper/classes', './dom-helper/prop'], function (exports, Morph, AttrMorph, build_html_dom, classes, prop) {

var doc = typeof document === "undefined" ? false : document;
var doc = typeof document === 'undefined' ? false : document;
var deletesBlankTextNodes = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(""));
var element = document.createElement('div');
element.appendChild(document.createTextNode(''));
var clonedElement = element.cloneNode(true);

@@ -16,4 +16,4 @@ return clonedElement.childNodes.length === 0;

var ignoresCheckedAttribute = doc && (function (document) {
var element = document.createElement("input");
element.setAttribute("checked", "checked");
var element = document.createElement('input');
element.setAttribute('checked', 'checked');
var clonedElement = element.cloneNode(false);

@@ -24,14 +24,14 @@ return !clonedElement.checked;

var canRemoveSvgViewBoxAttribute = doc && (doc.createElementNS ? (function (document) {
var element = document.createElementNS(build_html_dom.svgNamespace, "svg");
element.setAttribute("viewBox", "0 0 100 100");
element.removeAttribute("viewBox");
return !element.getAttribute("viewBox");
var element = document.createElementNS(build_html_dom.svgNamespace, 'svg');
element.setAttribute('viewBox', '0 0 100 100');
element.removeAttribute('viewBox');
return !element.getAttribute('viewBox');
})(doc) : true);
var canClone = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(" "));
element.appendChild(document.createTextNode(" "));
var element = document.createElement('div');
element.appendChild(document.createTextNode(' '));
element.appendChild(document.createTextNode(' '));
var clonedElement = element.cloneNode(true);
return clonedElement.childNodes[0].nodeValue === " ";
return clonedElement.childNodes[0].nodeValue === ' ';
})(doc);

@@ -77,3 +77,3 @@

// Omitted start tags are only inside table tags.
if (contextualElement.tagName === "TABLE") {
if (contextualElement.tagName === 'TABLE') {
var omittedStartTagChildMatch = omittedStartTagChildTest.exec(string);

@@ -84,3 +84,3 @@ if (omittedStartTagChildMatch) {

// and not the proper start tag. Just see if a tag was omitted.
return omittedStartTagChild === "tr" || omittedStartTagChild === "col";
return omittedStartTagChild === 'tr' || omittedStartTagChild === 'col';
}

@@ -91,4 +91,4 @@ }

function buildSVGDOM(html, dom) {
var div = dom.document.createElement("div");
div.innerHTML = "<svg>" + html + "</svg>";
var div = dom.document.createElement('div');
div.innerHTML = '<svg>' + html + '</svg>';
return div.firstChild.childNodes;

@@ -248,3 +248,3 @@ }

prototype.removeAttribute = function (element, name) {
if (element.tagName === "svg" && name === "viewBox") {
if (element.tagName === 'svg' && name === 'viewBox') {
element.setAttribute(name, null);

@@ -262,4 +262,4 @@ } else {

if (value === null && (name === "value" || name === "type" || name === "src")) {
value = "";
if (value === null && (name === 'value' || name === 'type' || name === 'src')) {
value = '';
}

@@ -276,3 +276,3 @@

var lowercaseName = name.toLowerCase();
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === "style") {
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === 'style') {
if (prop.isAttrRemovalValue(value)) {

@@ -293,3 +293,3 @@ element.removeAttribute(name);

if (type === "prop") {
if (type === 'prop') {
element[normalized] = value;

@@ -316,3 +316,3 @@ } else {

if (contextualElement) {
if (tagName === "svg") {
if (tagName === 'svg') {
namespace = build_html_dom.svgNamespace;

@@ -367,3 +367,3 @@ } else {

for (var i = 0, len = blankChildTextNodes.length; i < len; i++) {
var textNode = this.document.createTextNode(""),
var textNode = this.document.createTextNode(''),
offset = blankChildTextNodes[i],

@@ -379,3 +379,3 @@ before = this.childAtIndex(element, offset);

if (ignoresCheckedAttribute && isChecked) {
element.setAttribute("checked", "checked");
element.setAttribute('checked', 'checked');
}

@@ -436,3 +436,3 @@ };

if (!firstChild) {
var comment = this.createComment("");
var comment = this.createComment('');
this.appendChild(element, comment);

@@ -469,3 +469,3 @@ return Morph['default'].create(this, element, comment);

prototype.insertMorphBefore = function (element, referenceChild, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.insertBefore(insertion, referenceChild);

@@ -476,3 +476,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

prototype.appendMorph = function (element, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.appendChild(insertion);

@@ -485,3 +485,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

var child = index === null ? null : this.childAtIndex(fragment, index);
this.insertBefore(fragment, this.createTextNode(""), child);
this.insertBefore(fragment, this.createTextNode(''), child);
};

@@ -519,3 +519,3 @@

// related to auto-select behavior. Skip past it.
if (contextualElement.tagName === "SELECT") {
if (contextualElement.tagName === 'SELECT') {
currentNode = currentNode.nextSibling;

@@ -540,3 +540,3 @@ }

if (!parsingNode) {
parsingNode = this.document.createElement("a");
parsingNode = this.document.createElement('a');
}

@@ -569,3 +569,3 @@

var testEl = document.createElementNS(svgNamespace, 'title');
testEl.innerHTML = '<div></div>';
testEl.innerHTML = "<div></div>";
return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;

@@ -579,4 +579,4 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = '<div></div>';
testEl.firstChild.innerHTML = '<script></script>';
testEl.innerHTML = "<div></div>";
testEl.firstChild.innerHTML = "<script><\/script>";
return testEl.firstChild.innerHTML === '';

@@ -590,3 +590,3 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = 'Test: <script type=\'text/x-placeholder\'></script>Value';
testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value';

@@ -647,3 +647,3 @@ })(doc);

// At this point it's the actual unicode character.
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === '­') {
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
var newValue = shyElement.nodeValue.slice(1);

@@ -666,3 +666,3 @@ if (newValue.length) {

if (!outerHTML) {
throw 'Can\'t set innerHTML on ' + tagName + ' in this browser';
throw "Can't set innerHTML on " + tagName + " in this browser";
}

@@ -674,3 +674,3 @@

var startTag = outerHTML.match(new RegExp('<' + tagName + '([^>]*)>', 'i'))[0];
var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0];
var endTag = '</' + tagName + '>';

@@ -723,3 +723,3 @@

if (contextualElement.tagName === 'SELECT') {
html = '<option></option>' + html;
html = "<option></option>" + html;
}

@@ -955,2 +955,3 @@

*/
function normalizeProperty(element, slotName) {

@@ -1093,3 +1094,3 @@ var type, normalized;

if (element.namespaceURI === build_html_dom.svgNamespace || attrName === "style" || type === "attr") {
if (element.namespaceURI === build_html_dom.svgNamespace || attrName === 'style' || type === 'attr') {
this._update = updateAttribute;

@@ -1177,2 +1178,3 @@ this._get = getAttribute;

};
function sanitizeAttributeValue(dom, element, attribute, value) {

@@ -1179,0 +1181,0 @@ var tagName;

@@ -10,3 +10,3 @@ 'use strict';

var foreignNamespaces = ["foreignObject", "desc", "title"];
var foreignNamespaces = ['foreignObject', 'desc', 'title'];

@@ -22,3 +22,3 @@ var dom, i, foreignNamespace;

QUnit.module("DOM Helper", {
QUnit.module('DOM Helper', {
beforeEach: function () {

@@ -32,13 +32,13 @@ dom = new DOMHelper['default']();

test("#createElement", function () {
var node = dom.createElement("div");
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div></div>");
test('#createElement', function () {
var node = dom.createElement('div');
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div></div>');
});
test("#childAtIndex", function () {
var node = dom.createElement("div");
test('#childAtIndex', function () {
var node = dom.createElement('div');
var child1 = dom.createElement("p");
var child2 = dom.createElement("img");
var child1 = dom.createElement('p');
var child2 = dom.createElement('img');

@@ -50,3 +50,3 @@ strictEqual(dom.childAtIndex(node, 0), null);

dom.appendChild(node, child1);
strictEqual(dom.childAtIndex(node, 0).tagName, "P");
strictEqual(dom.childAtIndex(node, 0).tagName, 'P');
strictEqual(dom.childAtIndex(node, 1), null);

@@ -56,149 +56,149 @@ strictEqual(dom.childAtIndex(node, 2), null);

dom.insertBefore(node, child2, child1);
strictEqual(dom.childAtIndex(node, 0).tagName, "IMG");
strictEqual(dom.childAtIndex(node, 1).tagName, "P");
strictEqual(dom.childAtIndex(node, 0).tagName, 'IMG');
strictEqual(dom.childAtIndex(node, 1).tagName, 'P');
strictEqual(dom.childAtIndex(node, 2), null);
});
test("#appendText adds text", function () {
var node = dom.createElement("div");
var text = dom.appendText(node, "Howdy");
ok(!!text, "returns node");
htmlbars_test_helpers.equalHTML(node, "<div>Howdy</div>");
test('#appendText adds text', function () {
var node = dom.createElement('div');
var text = dom.appendText(node, 'Howdy');
ok(!!text, 'returns node');
htmlbars_test_helpers.equalHTML(node, '<div>Howdy</div>');
});
test("#setAttribute", function () {
var node = dom.createElement("div");
dom.setAttribute(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
dom.setAttribute(node, "id", null);
htmlbars_test_helpers.equalHTML(node, "<div id=\"null\"></div>");
test('#setAttribute', function () {
var node = dom.createElement('div');
dom.setAttribute(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
dom.setAttribute(node, 'id', null);
htmlbars_test_helpers.equalHTML(node, '<div id="null"></div>');
node = dom.createElement("input");
ok(node.getAttribute("disabled") === disabledAbsentValue, "precond: disabled is absent");
dom.setAttribute(node, "disabled", true);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled set to true is present");
dom.setAttribute(node, "disabled", false);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled set to false is present");
node = dom.createElement('input');
ok(node.getAttribute('disabled') === disabledAbsentValue, 'precond: disabled is absent');
dom.setAttribute(node, 'disabled', true);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled set to true is present');
dom.setAttribute(node, 'disabled', false);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled set to false is present');
});
test("#setAttributeNS", function () {
var node = dom.createElement("svg");
dom.setAttributeNS(node, xlinkNamespace, "xlink:href", "super-fun");
test('#setAttributeNS', function () {
var node = dom.createElement('svg');
dom.setAttributeNS(node, xlinkNamespace, 'xlink:href', 'super-fun');
// chrome adds (xmlns:xlink="http://www.w3.org/1999/xlink") property while others don't
// thus equalHTML is not useful
var el = document.createElement("div");
var el = document.createElement('div');
el.appendChild(node);
// phantomjs omits the prefix, thus we can't find xlink:
ok(el.innerHTML.indexOf("href=\"super-fun\"") > 0);
dom.setAttributeNS(node, xlinkNamespace, "href", null);
ok(el.innerHTML.indexOf('href="super-fun"') > 0);
dom.setAttributeNS(node, xlinkNamespace, 'href', null);
ok(el.innerHTML.indexOf("href=\"null\"") > 0);
ok(el.innerHTML.indexOf('href="null"') > 0);
});
test("#getElementById", function () {
var parentNode = dom.createElement("div"),
childNode = dom.createElement("div");
dom.setAttribute(parentNode, "id", "parent");
dom.setAttribute(childNode, "id", "child");
test('#getElementById', function () {
var parentNode = dom.createElement('div'),
childNode = dom.createElement('div');
dom.setAttribute(parentNode, 'id', 'parent');
dom.setAttribute(childNode, 'id', 'child');
dom.appendChild(parentNode, childNode);
dom.document.body.appendChild(parentNode);
htmlbars_test_helpers.equalHTML(dom.getElementById("child"), "<div id=\"child\"></div>");
htmlbars_test_helpers.equalHTML(dom.getElementById('child'), '<div id="child"></div>');
dom.document.body.removeChild(parentNode);
});
test("#setPropertyStrict", function () {
var node = dom.createElement("div");
dom.setPropertyStrict(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
test('#setPropertyStrict', function () {
var node = dom.createElement('div');
dom.setPropertyStrict(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
node = dom.createElement("input");
ok(node.getAttribute("disabled") === disabledAbsentValue, "precond: disabled is absent");
dom.setPropertyStrict(node, "disabled", true);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled is present");
dom.setPropertyStrict(node, "disabled", false);
ok(node.getAttribute("disabled") === disabledAbsentValue, "disabled has been removed");
node = dom.createElement('input');
ok(node.getAttribute('disabled') === disabledAbsentValue, 'precond: disabled is absent');
dom.setPropertyStrict(node, 'disabled', true);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled is present');
dom.setPropertyStrict(node, 'disabled', false);
ok(node.getAttribute('disabled') === disabledAbsentValue, 'disabled has been removed');
});
// IE dislikes undefined or null for value
test("#setPropertyStrict value", function () {
var node = dom.createElement("input");
dom.setPropertyStrict(node, "value", undefined);
equal(node.value, "", "blank string is set for undefined");
dom.setPropertyStrict(node, "value", null);
equal(node.value, "", "blank string is set for undefined");
test('#setPropertyStrict value', function () {
var node = dom.createElement('input');
dom.setPropertyStrict(node, 'value', undefined);
equal(node.value, '', 'blank string is set for undefined');
dom.setPropertyStrict(node, 'value', null);
equal(node.value, '', 'blank string is set for undefined');
});
// IE dislikes undefined or null for type
test("#setPropertyStrict type", function () {
var node = dom.createElement("input");
dom.setPropertyStrict(node, "type", undefined);
equal(node.type, "text", "text default is set for undefined");
dom.setPropertyStrict(node, "type", null);
equal(node.type, "text", "text default is set for undefined");
test('#setPropertyStrict type', function () {
var node = dom.createElement('input');
dom.setPropertyStrict(node, 'type', undefined);
equal(node.type, 'text', 'text default is set for undefined');
dom.setPropertyStrict(node, 'type', null);
equal(node.type, 'text', 'text default is set for undefined');
});
// setting undefined or null to src makes a network request
test("#setPropertyStrict src", function () {
var node = dom.createElement("img");
dom.setPropertyStrict(node, "src", undefined);
notEqual(node.src, undefined, "blank string is set for undefined");
dom.setPropertyStrict(node, "src", null);
notEqual(node.src, null, "blank string is set for undefined");
test('#setPropertyStrict src', function () {
var node = dom.createElement('img');
dom.setPropertyStrict(node, 'src', undefined);
notEqual(node.src, undefined, 'blank string is set for undefined');
dom.setPropertyStrict(node, 'src', null);
notEqual(node.src, null, 'blank string is set for undefined');
});
test("#removeAttribute", function () {
var node = dom.createElement("div");
dom.setAttribute(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>", "precond - attribute exists");
test('#removeAttribute', function () {
var node = dom.createElement('div');
dom.setAttribute(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>', 'precond - attribute exists');
dom.removeAttribute(node, "id");
htmlbars_test_helpers.equalHTML(node, "<div></div>", "attribute was removed");
dom.removeAttribute(node, 'id');
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'attribute was removed');
});
test("#removeAttribute of SVG", function () {
test('#removeAttribute of SVG', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("svg");
dom.setAttribute(node, "viewBox", "0 0 100 100");
htmlbars_test_helpers.equalHTML(node, "<svg viewBox=\"0 0 100 100\"></svg>", "precond - attribute exists");
var node = dom.createElement('svg');
dom.setAttribute(node, 'viewBox', '0 0 100 100');
htmlbars_test_helpers.equalHTML(node, '<svg viewBox="0 0 100 100"></svg>', 'precond - attribute exists');
dom.removeAttribute(node, "viewBox");
htmlbars_test_helpers.equalHTML(node, "<svg></svg>", "attribute was removed");
dom.removeAttribute(node, 'viewBox');
htmlbars_test_helpers.equalHTML(node, '<svg></svg>', 'attribute was removed');
});
test("#setProperty", function () {
var node = dom.createElement("div");
dom.setProperty(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
dom.setProperty(node, "id", null);
ok(node.getAttribute("id") !== "super-tag", "null property sets to the property");
test('#setProperty', function () {
var node = dom.createElement('div');
dom.setProperty(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
dom.setProperty(node, 'id', null);
ok(node.getAttribute('id') !== 'super-tag', 'null property sets to the property');
node = dom.createElement("div");
dom.setProperty(node, "data-fun", "whoopie");
htmlbars_test_helpers.equalHTML(node, "<div data-fun=\"whoopie\"></div>");
dom.setProperty(node, "data-fun", null);
htmlbars_test_helpers.equalHTML(node, "<div></div>", "null attribute removes the attribute");
node = dom.createElement('div');
dom.setProperty(node, 'data-fun', 'whoopie');
htmlbars_test_helpers.equalHTML(node, '<div data-fun="whoopie"></div>');
dom.setProperty(node, 'data-fun', null);
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'null attribute removes the attribute');
node = dom.createElement("input");
dom.setProperty(node, "disabled", true);
node = dom.createElement('input');
dom.setProperty(node, 'disabled', true);
equal(node.disabled, true);
dom.setProperty(node, "disabled", false);
dom.setProperty(node, 'disabled', false);
equal(node.disabled, false);
node = dom.createElement("div");
dom.setProperty(node, "style", "color: red;");
htmlbars_test_helpers.equalHTML(node, "<div style=\"color: red;\"></div>");
node = dom.createElement('div');
dom.setProperty(node, 'style', 'color: red;');
htmlbars_test_helpers.equalHTML(node, '<div style="color: red;"></div>');
});
test("#setProperty removes attr with undefined", function () {
var node = dom.createElement("div");
dom.setProperty(node, "data-fun", "whoopie");
htmlbars_test_helpers.equalHTML(node, "<div data-fun=\"whoopie\"></div>");
dom.setProperty(node, "data-fun", undefined);
htmlbars_test_helpers.equalHTML(node, "<div></div>", "undefined attribute removes the attribute");
test('#setProperty removes attr with undefined', function () {
var node = dom.createElement('div');
dom.setProperty(node, 'data-fun', 'whoopie');
htmlbars_test_helpers.equalHTML(node, '<div data-fun="whoopie"></div>');
dom.setProperty(node, 'data-fun', undefined);
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'undefined attribute removes the attribute');
});
test("#setProperty uses setAttribute for special non-compliant element props", function () {
test('#setProperty uses setAttribute for special non-compliant element props', function () {
expect(6);
var badPairs = [{ tagName: "button", key: "type", value: "submit", selfClosing: false }, { tagName: "input", key: "type", value: "x-not-supported", selfClosing: true }];
var badPairs = [{ tagName: 'button', key: 'type', value: 'submit', selfClosing: false }, { tagName: 'input', key: 'type', value: 'x-not-supported', selfClosing: true }];

@@ -210,4 +210,4 @@ badPairs.forEach(function (pair) {

node.setAttribute = function (attrName, value) {
equal(attrName, pair.key, "setAttribute called with correct attrName");
equal(value, pair.value, "setAttribute called with correct value");
equal(attrName, pair.key, 'setAttribute called with correct attrName');
equal(value, pair.value, 'setAttribute called with correct value');
return setAttribute.call(this, attrName, value);

@@ -219,49 +219,49 @@ };

// e.g. <button type="submit"></button>
var expected = "<" + pair.tagName + " " + pair.key + "=\"" + pair.value + "\">";
var expected = '<' + pair.tagName + ' ' + pair.key + '="' + pair.value + '">';
if (pair.selfClosing === false) {
expected += "</" + pair.tagName + ">";
expected += '</' + pair.tagName + '>';
}
htmlbars_test_helpers.equalHTML(node, expected, "output html is correct");
htmlbars_test_helpers.equalHTML(node, expected, 'output html is correct');
});
});
test("#addClasses", function () {
var node = dom.createElement("div");
dom.addClasses(node, ["super-fun"]);
equal(node.className, "super-fun");
dom.addClasses(node, ["super-fun"]);
equal(node.className, "super-fun");
dom.addClasses(node, ["super-blast"]);
equal(node.className, "super-fun super-blast");
dom.addClasses(node, ["bacon", "ham"]);
equal(node.className, "super-fun super-blast bacon ham");
test('#addClasses', function () {
var node = dom.createElement('div');
dom.addClasses(node, ['super-fun']);
equal(node.className, 'super-fun');
dom.addClasses(node, ['super-fun']);
equal(node.className, 'super-fun');
dom.addClasses(node, ['super-blast']);
equal(node.className, 'super-fun super-blast');
dom.addClasses(node, ['bacon', 'ham']);
equal(node.className, 'super-fun super-blast bacon ham');
});
test("#removeClasses", function () {
var node = dom.createElement("div");
node.setAttribute("class", "this-class that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.className, "that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.className, "that-class");
dom.removeClasses(node, ["that-class"]);
equal(node.className, "");
node.setAttribute("class", "woop moop jeep");
dom.removeClasses(node, ["moop", "jeep"]);
equal(node.className, "woop");
test('#removeClasses', function () {
var node = dom.createElement('div');
node.setAttribute('class', 'this-class that-class');
dom.removeClasses(node, ['this-class']);
equal(node.className, 'that-class');
dom.removeClasses(node, ['this-class']);
equal(node.className, 'that-class');
dom.removeClasses(node, ['that-class']);
equal(node.className, '');
node.setAttribute('class', 'woop moop jeep');
dom.removeClasses(node, ['moop', 'jeep']);
equal(node.className, 'woop');
});
test("#createElement of tr with contextual table element", function () {
var tableElement = document.createElement("table"),
node = dom.createElement("tr", tableElement);
equal(node.tagName, "TR");
htmlbars_test_helpers.equalHTML(node, "<tr></tr>");
test('#createElement of tr with contextual table element', function () {
var tableElement = document.createElement('table'),
node = dom.createElement('tr', tableElement);
equal(node.tagName, 'TR');
htmlbars_test_helpers.equalHTML(node, '<tr></tr>');
});
test("#createMorph has optional contextualElement", function () {
var parent = document.createElement("div"),
test('#createMorph has optional contextualElement', function () {
var parent = document.createElement('div'),
fragment = document.createDocumentFragment(),
start = document.createTextNode(""),
end = document.createTextNode(""),
start = document.createTextNode(''),
end = document.createTextNode(''),
morph,

@@ -275,3 +275,3 @@ thrown;

}
ok(thrown, "Exception thrown when a fragment is provided for contextualElement");
ok(thrown, 'Exception thrown when a fragment is provided for contextualElement');

@@ -285,33 +285,33 @@ morph = dom.createMorph(fragment, start, end, parent);

test("#appendMorph", function () {
var element = document.createElement("div");
test('#appendMorph', function () {
var element = document.createElement('div');
dom.appendText(element, "a");
dom.appendText(element, 'a');
var morph = dom.appendMorph(element);
dom.appendText(element, "c");
dom.appendText(element, 'c');
morph.setContent("b");
morph.setContent('b');
equal(element.innerHTML, "abc");
equal(element.innerHTML, 'abc');
});
test("#insertMorphBefore", function () {
var element = document.createElement("div");
test('#insertMorphBefore', function () {
var element = document.createElement('div');
dom.appendText(element, "a");
var c = dom.appendText(element, "c");
dom.appendText(element, 'a');
var c = dom.appendText(element, 'c');
var morph = dom.insertMorphBefore(element, c);
morph.setContent("b");
morph.setContent('b');
equal(element.innerHTML, "abc");
equal(element.innerHTML, 'abc');
});
test("#parseHTML combinations", function () {
test('#parseHTML combinations', function () {
var parsingCombinations = [
// omitted start tags
//
["table", "<tr><td>Yo</td></tr>", "TR"], ["table", "<tbody><tr></tr></tbody>", "TBODY"], ["table", "<col></col>", "COL"],
['table', '<tr><td>Yo</td></tr>', 'TR'], ['table', '<tbody><tr></tr></tbody>', 'TBODY'], ['table', '<col></col>', 'COL'],
// elements with broken innerHTML in IE9 and down
["select", "<option></option>", "OPTION"], ["colgroup", "<col></col>", "COL"], ["tbody", "<tr></tr>", "TR"], ["tfoot", "<tr></tr>", "TR"], ["thead", "<tr></tr>", "TR"], ["tr", "<td></td>", "TD"], ["div", "<script></script>", "SCRIPT"]];
['select', '<option></option>', 'OPTION'], ['colgroup', '<col></col>', 'COL'], ['tbody', '<tr></tr>', 'TR'], ['tfoot', '<tr></tr>', 'TR'], ['thead', '<tr></tr>', 'TR'], ['tr', '<td></td>', 'TD'], ['div', '<script></script>', 'SCRIPT']];

@@ -326,93 +326,93 @@ var contextTag, content, expectedTagName, contextElement, nodes;

nodes = dom.parseHTML(content, contextElement).childNodes;
equal(nodes[0].tagName, expectedTagName, "#parseHTML of " + content + " returns a " + expectedTagName + " inside a " + contextTag + " context");
equal(nodes[0].tagName, expectedTagName, '#parseHTML of ' + content + ' returns a ' + expectedTagName + ' inside a ' + contextTag + ' context');
}
});
test("#parseHTML of script then tr inside table context wraps the tr in a tbody", function () {
var tableElement = document.createElement("table"),
nodes = dom.parseHTML("<script></script><tr><td>Yo</td></tr>", tableElement).childNodes;
test('#parseHTML of script then tr inside table context wraps the tr in a tbody', function () {
var tableElement = document.createElement('table'),
nodes = dom.parseHTML('<script></script><tr><td>Yo</td></tr>', tableElement).childNodes;
// The HTML spec suggests the first item must be the child of
// the omittable start tag. Here script is the first child, so no-go.
equal(nodes.length, 2, "Leading script tag corrupts");
equal(nodes[0].tagName, "SCRIPT");
equal(nodes[1].tagName, "TBODY");
equal(nodes.length, 2, 'Leading script tag corrupts');
equal(nodes[0].tagName, 'SCRIPT');
equal(nodes[1].tagName, 'TBODY');
});
test("#parseHTML of select allows the initial implicit option selection to remain", function () {
var div = document.createElement("div");
var select = dom.parseHTML("<select><option></option></select>", div).childNodes[0];
test('#parseHTML of select allows the initial implicit option selection to remain', function () {
var div = document.createElement('div');
var select = dom.parseHTML('<select><option></option></select>', div).childNodes[0];
ok(select.childNodes[0].selected, "first element is selected");
ok(select.childNodes[0].selected, 'first element is selected');
});
test("#parseHTML of options removes an implicit selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\"></option><option value=\"2\"></option>", select).childNodes;
test('#parseHTML of options removes an implicit selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1"></option><option value="2"></option>', select).childNodes;
ok(!options[0].selected, "first element is not selected");
ok(!options[1].selected, "second element is not selected");
ok(!options[0].selected, 'first element is not selected');
ok(!options[1].selected, 'second element is not selected');
});
test("#parseHTML of options leaves an explicit first selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\" selected></option><option value=\"2\"></option>", select).childNodes;
test('#parseHTML of options leaves an explicit first selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1" selected></option><option value="2"></option>', select).childNodes;
ok(options[0].selected, "first element is selected");
ok(!options[1].selected, "second element is not selected");
ok(options[0].selected, 'first element is selected');
ok(!options[1].selected, 'second element is not selected');
});
test("#parseHTML of options leaves an explicit second selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\"></option><option value=\"2\" selected=\"selected\"></option>", select).childNodes;
test('#parseHTML of options leaves an explicit second selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1"></option><option value="2" selected="selected"></option>', select).childNodes;
ok(!options[0].selected, "first element is not selected");
ok(options[1].selected, "second element is selected");
ok(!options[0].selected, 'first element is not selected');
ok(options[1].selected, 'second element is selected');
});
test("#parseHTML of script then tr inside tbody context", function () {
var tbodyElement = document.createElement("tbody"),
nodes = dom.parseHTML("<script></script><tr><td>Yo</td></tr>", tbodyElement).childNodes;
equal(nodes.length, 2, "Leading script tag corrupts");
equal(nodes[0].tagName, "SCRIPT");
equal(nodes[1].tagName, "TR");
test('#parseHTML of script then tr inside tbody context', function () {
var tbodyElement = document.createElement('tbody'),
nodes = dom.parseHTML('<script></script><tr><td>Yo</td></tr>', tbodyElement).childNodes;
equal(nodes.length, 2, 'Leading script tag corrupts');
equal(nodes[0].tagName, 'SCRIPT');
equal(nodes[1].tagName, 'TR');
});
test("#parseHTML with retains whitespace", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("leading<script id=\"first\"></script> <script id=\"second\"></script><div><script></script> <script></script>, indeed.</div>", div).childNodes;
equal(nodes[0].data, "leading");
equal(nodes[1].tagName, "SCRIPT");
equal(nodes[2].data, " ");
equal(nodes[3].tagName, "SCRIPT");
equal(nodes[4].tagName, "DIV");
equal(nodes[4].childNodes[0].tagName, "SCRIPT");
equal(nodes[4].childNodes[1].data, " ");
equal(nodes[4].childNodes[2].tagName, "SCRIPT");
equal(nodes[4].childNodes[3].data, ", indeed.");
test('#parseHTML with retains whitespace', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('leading<script id="first"></script> <script id="second"></script><div><script></script> <script></script>, indeed.</div>', div).childNodes;
equal(nodes[0].data, 'leading');
equal(nodes[1].tagName, 'SCRIPT');
equal(nodes[2].data, ' ');
equal(nodes[3].tagName, 'SCRIPT');
equal(nodes[4].tagName, 'DIV');
equal(nodes[4].childNodes[0].tagName, 'SCRIPT');
equal(nodes[4].childNodes[1].data, ' ');
equal(nodes[4].childNodes[2].tagName, 'SCRIPT');
equal(nodes[4].childNodes[3].data, ', indeed.');
});
test("#parseHTML with retains whitespace of top element", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("<span>hello <script id=\"first\"></script> yeah</span>", div).childNodes;
equal(nodes[0].tagName, "SPAN");
htmlbars_test_helpers.equalHTML(nodes, "<span>hello <script id=\"first\"></script> yeah</span>");
test('#parseHTML with retains whitespace of top element', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('<span>hello <script id="first"></script> yeah</span>', div).childNodes;
equal(nodes[0].tagName, 'SPAN');
htmlbars_test_helpers.equalHTML(nodes, '<span>hello <script id="first"></script> yeah</span>');
});
test("#parseHTML with retains whitespace after script", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("<span>hello</span><script id=\"first\"></script><span><script></script> kwoop</span>", div).childNodes;
equal(nodes[0].tagName, "SPAN");
equal(nodes[1].tagName, "SCRIPT");
equal(nodes[2].tagName, "SPAN");
htmlbars_test_helpers.equalHTML(nodes, "<span>hello</span><script id=\"first\"></script><span><script></script> kwoop</span>");
test('#parseHTML with retains whitespace after script', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('<span>hello</span><script id="first"></script><span><script></script> kwoop</span>', div).childNodes;
equal(nodes[0].tagName, 'SPAN');
equal(nodes[1].tagName, 'SCRIPT');
equal(nodes[2].tagName, 'SPAN');
htmlbars_test_helpers.equalHTML(nodes, '<span>hello</span><script id="first"></script><span><script></script> kwoop</span>');
});
test("#parseHTML of number", function () {
var div = document.createElement("div");
test('#parseHTML of number', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML(5, div).childNodes;
equal(nodes[0].data, "5");
htmlbars_test_helpers.equalHTML(nodes, "5");
equal(nodes[0].data, '5');
htmlbars_test_helpers.equalHTML(nodes, '5');
});
test("#protocolForURL", function () {
test('#protocolForURL', function () {
var protocol = dom.protocolForURL("http://www.emberjs.com");

@@ -427,28 +427,28 @@ equal(protocol, "http:");

test("#cloneNode shallow", function () {
var divElement = document.createElement("div");
test('#cloneNode shallow', function () {
var divElement = document.createElement('div');
divElement.appendChild(document.createElement("span"));
divElement.appendChild(document.createElement('span'));
var node = dom.cloneNode(divElement, false);
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div></div>");
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div></div>');
});
test("#cloneNode deep", function () {
var divElement = document.createElement("div");
test('#cloneNode deep', function () {
var divElement = document.createElement('div');
divElement.appendChild(document.createElement("span"));
divElement.appendChild(document.createElement('span'));
var node = dom.cloneNode(divElement, true);
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div><span></span></div>");
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div><span></span></div>');
});
test("dom node has empty text after cloning and ensuringBlankTextNode", function () {
var div = document.createElement("div");
test('dom node has empty text after cloning and ensuringBlankTextNode', function () {
var div = document.createElement('div');
div.appendChild(document.createTextNode(""));
div.appendChild(document.createTextNode(''));

@@ -458,3 +458,3 @@ var clonedDiv = dom.cloneNode(div, true);

equal(clonedDiv.nodeType, 1);
htmlbars_test_helpers.equalHTML(clonedDiv, "<div></div>");
htmlbars_test_helpers.equalHTML(clonedDiv, '<div></div>');
// IE's native cloneNode drops blank string text

@@ -468,7 +468,7 @@ // nodes. Assert repairClonedNode brings back the blank

test("dom node has empty start text after cloning and ensuringBlankTextNode", function () {
var div = document.createElement("div");
test('dom node has empty start text after cloning and ensuringBlankTextNode', function () {
var div = document.createElement('div');
div.appendChild(document.createTextNode(""));
div.appendChild(document.createElement("span"));
div.appendChild(document.createTextNode(''));
div.appendChild(document.createElement('span'));

@@ -478,3 +478,3 @@ var clonedDiv = dom.cloneNode(div, true);

equal(clonedDiv.nodeType, 1);
htmlbars_test_helpers.equalHTML(clonedDiv, "<div><span></span></div>");
htmlbars_test_helpers.equalHTML(clonedDiv, '<div><span></span></div>');
// IE's native cloneNode drops blank string text

@@ -488,7 +488,7 @@ // nodes. Assert denormalizeText brings back the blank

test("dom node checked after cloning and ensuringChecked", function () {
var input = document.createElement("input");
test('dom node checked after cloning and ensuringChecked', function () {
var input = document.createElement('input');
input.setAttribute("checked", "checked");
ok(input.checked, "input is checked");
input.setAttribute('checked', 'checked');
ok(input.checked, 'input is checked');

@@ -501,9 +501,9 @@ var clone = dom.cloneNode(input, false);

htmlbars_test_helpers.isCheckedInputHTML(clone, "<input checked=\"checked\">");
ok(clone.checked, "clone is checked");
htmlbars_test_helpers.isCheckedInputHTML(clone, '<input checked="checked">');
ok(clone.checked, 'clone is checked');
});
if ("namespaceURI" in document.createElement("div")) {
if ('namespaceURI' in document.createElement('div')) {
QUnit.module("DOM Helper namespaces", {
QUnit.module('DOM Helper namespaces', {
beforeEach: function () {

@@ -517,65 +517,65 @@ dom = new DOMHelper['default']();

test("#createElement div is xhtml", function () {
var node = dom.createElement("div");
test('#createElement div is xhtml', function () {
var node = dom.createElement('div');
equal(node.namespaceURI, xhtmlNamespace);
});
test("#createElement of svg with svg namespace", function () {
test('#createElement of svg with svg namespace', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("svg");
equal(node.tagName, "svg");
var node = dom.createElement('svg');
equal(node.tagName, 'svg');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of path with detected svg contextual element", function () {
test('#createElement of path with detected svg contextual element', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("path");
equal(node.tagName, "path");
var node = dom.createElement('path');
equal(node.tagName, 'path');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of path with svg contextual element", function () {
var node = dom.createElement("path", document.createElementNS(svgNamespace, "svg"));
equal(node.tagName, "path");
test('#createElement of path with svg contextual element', function () {
var node = dom.createElement('path', document.createElementNS(svgNamespace, 'svg'));
equal(node.tagName, 'path');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of svg with div namespace", function () {
var node = dom.createElement("svg", document.createElement("div"));
equal(node.tagName, "svg");
test('#createElement of svg with div namespace', function () {
var node = dom.createElement('svg', document.createElement('div'));
equal(node.tagName, 'svg');
equal(node.namespaceURI, svgNamespace);
});
test("#getElementById with different root node", function () {
var doc = document.implementation.createDocument(xhtmlNamespace, "html", null),
body = document.createElementNS(xhtmlNamespace, "body"),
parentNode = dom.createElement("div"),
childNode = dom.createElement("div");
test('#getElementById with different root node', function () {
var doc = document.implementation.createDocument(xhtmlNamespace, 'html', null),
body = document.createElementNS(xhtmlNamespace, 'body'),
parentNode = dom.createElement('div'),
childNode = dom.createElement('div');
doc.documentElement.appendChild(body);
dom.setAttribute(parentNode, "id", "parent");
dom.setAttribute(childNode, "id", "child");
dom.setAttribute(parentNode, 'id', 'parent');
dom.setAttribute(childNode, 'id', 'child');
dom.appendChild(parentNode, childNode);
dom.appendChild(body, parentNode);
htmlbars_test_helpers.equalHTML(dom.getElementById("child", doc), "<div id=\"child\"></div>");
htmlbars_test_helpers.equalHTML(dom.getElementById('child', doc), '<div id="child"></div>');
});
test("#setProperty with namespaced attributes", function () {
test('#setProperty with namespaced attributes', function () {
var node;
dom.setNamespace(svgNamespace);
node = dom.createElement("svg");
dom.setProperty(node, "viewBox", "0 0 0 0");
htmlbars_test_helpers.equalHTML(node, "<svg viewBox=\"0 0 0 0\"></svg>");
node = dom.createElement('svg');
dom.setProperty(node, 'viewBox', '0 0 0 0');
htmlbars_test_helpers.equalHTML(node, '<svg viewBox="0 0 0 0"></svg>');
dom.setProperty(node, "xlink:title", "super-blast", xlinkNamespace);
dom.setProperty(node, 'xlink:title', 'super-blast', xlinkNamespace);
// chrome adds (xmlns:xlink="http://www.w3.org/1999/xlink") property while others don't
// thus equalHTML is not useful
var el = document.createElement("div");
var el = document.createElement('div');
el.appendChild(node);
// phantom js omits the prefix so we can't look for xlink:
ok(el.innerHTML.indexOf("title=\"super-blast\"") > 0);
ok(el.innerHTML.indexOf('title="super-blast"') > 0);
dom.setProperty(node, "xlink:title", null, xlinkNamespace);
equal(node.getAttribute("xlink:title"), null, "ns attr is removed");
dom.setProperty(node, 'xlink:title', null, xlinkNamespace);
equal(node.getAttribute('xlink:title'), null, 'ns attr is removed');
});

@@ -586,6 +586,6 @@

node = dom.createElement("svg");
dom.setProperty(node, "xlink:title", "Great Title", xlinkNamespace);
dom.setProperty(node, "xlink:title", undefined, xlinkNamespace);
equal(node.getAttribute("xlink:title"), undefined, "ns attr is removed");
node = dom.createElement('svg');
dom.setProperty(node, 'xlink:title', 'Great Title', xlinkNamespace);
dom.setProperty(node, 'xlink:title', undefined, xlinkNamespace);
equal(node.getAttribute('xlink:title'), undefined, 'ns attr is removed');
});

@@ -596,13 +596,13 @@

test("#createElement of div with " + foreignNamespace + " contextual element", function () {
var node = dom.createElement("div", document.createElementNS(svgNamespace, foreignNamespace));
equal(node.tagName, "DIV");
test('#createElement of div with ' + foreignNamespace + ' contextual element', function () {
var node = dom.createElement('div', document.createElementNS(svgNamespace, foreignNamespace));
equal(node.tagName, 'DIV');
equal(node.namespaceURI, xhtmlNamespace);
}); // jshint ignore:line
test("#parseHTML of div with " + foreignNamespace, function () {
test('#parseHTML of div with ' + foreignNamespace, function () {
dom.setNamespace(xhtmlNamespace);
var foreignObject = document.createElementNS(svgNamespace, foreignNamespace),
nodes = dom.parseHTML("<div></div>", foreignObject).childNodes;
equal(nodes[0].tagName, "DIV");
nodes = dom.parseHTML('<div></div>', foreignObject).childNodes;
equal(nodes[0].tagName, 'DIV');
equal(nodes[0].namespaceURI, xhtmlNamespace);

@@ -612,38 +612,38 @@ }); // jshint ignore:line

test("#parseHTML of path with svg contextual element", function () {
test('#parseHTML of path with svg contextual element', function () {
dom.setNamespace(svgNamespace);
var svgElement = document.createElementNS(svgNamespace, "svg"),
nodes = dom.parseHTML("<path></path>", svgElement).childNodes;
equal(nodes[0].tagName, "path");
var svgElement = document.createElementNS(svgNamespace, 'svg'),
nodes = dom.parseHTML('<path></path>', svgElement).childNodes;
equal(nodes[0].tagName, 'path');
equal(nodes[0].namespaceURI, svgNamespace);
});
test("#parseHTML of stop with linearGradient contextual element", function () {
test('#parseHTML of stop with linearGradient contextual element', function () {
dom.setNamespace(svgNamespace);
var svgElement = document.createElementNS(svgNamespace, "linearGradient"),
nodes = dom.parseHTML("<stop />", svgElement).childNodes;
equal(nodes[0].tagName, "stop");
var svgElement = document.createElementNS(svgNamespace, 'linearGradient'),
nodes = dom.parseHTML('<stop />', svgElement).childNodes;
equal(nodes[0].tagName, 'stop');
equal(nodes[0].namespaceURI, svgNamespace);
});
test("#addClasses on SVG", function () {
var node = document.createElementNS(svgNamespace, "svg");
dom.addClasses(node, ["super-fun"]);
equal(node.getAttribute("class"), "super-fun");
dom.addClasses(node, ["super-fun"]);
equal(node.getAttribute("class"), "super-fun");
dom.addClasses(node, ["super-blast"]);
equal(node.getAttribute("class"), "super-fun super-blast");
test('#addClasses on SVG', function () {
var node = document.createElementNS(svgNamespace, 'svg');
dom.addClasses(node, ['super-fun']);
equal(node.getAttribute('class'), 'super-fun');
dom.addClasses(node, ['super-fun']);
equal(node.getAttribute('class'), 'super-fun');
dom.addClasses(node, ['super-blast']);
equal(node.getAttribute('class'), 'super-fun super-blast');
});
test("#removeClasses on SVG", function () {
var node = document.createElementNS(svgNamespace, "svg");
node.setAttribute("class", "this-class that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.getAttribute("class"), "that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.getAttribute("class"), "that-class");
dom.removeClasses(node, ["that-class"]);
equal(node.getAttribute("class"), "");
test('#removeClasses on SVG', function () {
var node = document.createElementNS(svgNamespace, 'svg');
node.setAttribute('class', 'this-class that-class');
dom.removeClasses(node, ['this-class']);
equal(node.getAttribute('class'), 'that-class');
dom.removeClasses(node, ['this-class']);
equal(node.getAttribute('class'), 'that-class');
dom.removeClasses(node, ['that-class']);
equal(node.getAttribute('class'), '');
});
}

@@ -9,7 +9,7 @@ 'use strict';

var doc = typeof document === "undefined" ? false : document;
var doc = typeof document === 'undefined' ? false : document;
var deletesBlankTextNodes = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(""));
var element = document.createElement('div');
element.appendChild(document.createTextNode(''));
var clonedElement = element.cloneNode(true);

@@ -20,4 +20,4 @@ return clonedElement.childNodes.length === 0;

var ignoresCheckedAttribute = doc && (function (document) {
var element = document.createElement("input");
element.setAttribute("checked", "checked");
var element = document.createElement('input');
element.setAttribute('checked', 'checked');
var clonedElement = element.cloneNode(false);

@@ -28,14 +28,14 @@ return !clonedElement.checked;

var canRemoveSvgViewBoxAttribute = doc && (doc.createElementNS ? (function (document) {
var element = document.createElementNS(build_html_dom.svgNamespace, "svg");
element.setAttribute("viewBox", "0 0 100 100");
element.removeAttribute("viewBox");
return !element.getAttribute("viewBox");
var element = document.createElementNS(build_html_dom.svgNamespace, 'svg');
element.setAttribute('viewBox', '0 0 100 100');
element.removeAttribute('viewBox');
return !element.getAttribute('viewBox');
})(doc) : true);
var canClone = doc && (function (document) {
var element = document.createElement("div");
element.appendChild(document.createTextNode(" "));
element.appendChild(document.createTextNode(" "));
var element = document.createElement('div');
element.appendChild(document.createTextNode(' '));
element.appendChild(document.createTextNode(' '));
var clonedElement = element.cloneNode(true);
return clonedElement.childNodes[0].nodeValue === " ";
return clonedElement.childNodes[0].nodeValue === ' ';
})(doc);

@@ -81,3 +81,3 @@

// Omitted start tags are only inside table tags.
if (contextualElement.tagName === "TABLE") {
if (contextualElement.tagName === 'TABLE') {
var omittedStartTagChildMatch = omittedStartTagChildTest.exec(string);

@@ -88,3 +88,3 @@ if (omittedStartTagChildMatch) {

// and not the proper start tag. Just see if a tag was omitted.
return omittedStartTagChild === "tr" || omittedStartTagChild === "col";
return omittedStartTagChild === 'tr' || omittedStartTagChild === 'col';
}

@@ -95,4 +95,4 @@ }

function buildSVGDOM(html, dom) {
var div = dom.document.createElement("div");
div.innerHTML = "<svg>" + html + "</svg>";
var div = dom.document.createElement('div');
div.innerHTML = '<svg>' + html + '</svg>';
return div.firstChild.childNodes;

@@ -252,3 +252,3 @@ }

prototype.removeAttribute = function (element, name) {
if (element.tagName === "svg" && name === "viewBox") {
if (element.tagName === 'svg' && name === 'viewBox') {
element.setAttribute(name, null);

@@ -266,4 +266,4 @@ } else {

if (value === null && (name === "value" || name === "type" || name === "src")) {
value = "";
if (value === null && (name === 'value' || name === 'type' || name === 'src')) {
value = '';
}

@@ -280,3 +280,3 @@

var lowercaseName = name.toLowerCase();
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === "style") {
if (element.namespaceURI === build_html_dom.svgNamespace || lowercaseName === 'style') {
if (prop.isAttrRemovalValue(value)) {

@@ -297,3 +297,3 @@ element.removeAttribute(name);

if (type === "prop") {
if (type === 'prop') {
element[normalized] = value;

@@ -320,3 +320,3 @@ } else {

if (contextualElement) {
if (tagName === "svg") {
if (tagName === 'svg') {
namespace = build_html_dom.svgNamespace;

@@ -371,3 +371,3 @@ } else {

for (var i = 0, len = blankChildTextNodes.length; i < len; i++) {
var textNode = this.document.createTextNode(""),
var textNode = this.document.createTextNode(''),
offset = blankChildTextNodes[i],

@@ -383,3 +383,3 @@ before = this.childAtIndex(element, offset);

if (ignoresCheckedAttribute && isChecked) {
element.setAttribute("checked", "checked");
element.setAttribute('checked', 'checked');
}

@@ -440,3 +440,3 @@ };

if (!firstChild) {
var comment = this.createComment("");
var comment = this.createComment('');
this.appendChild(element, comment);

@@ -473,3 +473,3 @@ return Morph['default'].create(this, element, comment);

prototype.insertMorphBefore = function (element, referenceChild, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.insertBefore(insertion, referenceChild);

@@ -480,3 +480,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

prototype.appendMorph = function (element, contextualElement) {
var insertion = this.document.createComment("");
var insertion = this.document.createComment('');
element.appendChild(insertion);

@@ -489,3 +489,3 @@ return this.createMorph(element, insertion, insertion, contextualElement);

var child = index === null ? null : this.childAtIndex(fragment, index);
this.insertBefore(fragment, this.createTextNode(""), child);
this.insertBefore(fragment, this.createTextNode(''), child);
};

@@ -523,3 +523,3 @@

// related to auto-select behavior. Skip past it.
if (contextualElement.tagName === "SELECT") {
if (contextualElement.tagName === 'SELECT') {
currentNode = currentNode.nextSibling;

@@ -544,3 +544,3 @@ }

if (!parsingNode) {
parsingNode = this.document.createElement("a");
parsingNode = this.document.createElement('a');
}

@@ -547,0 +547,0 @@

@@ -17,3 +17,3 @@ 'use strict';

var testEl = document.createElementNS(svgNamespace, 'title');
testEl.innerHTML = '<div></div>';
testEl.innerHTML = "<div></div>";
return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;

@@ -27,4 +27,4 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = '<div></div>';
testEl.firstChild.innerHTML = '<script></script>';
testEl.innerHTML = "<div></div>";
testEl.firstChild.innerHTML = "<script><\/script>";
return testEl.firstChild.innerHTML === '';

@@ -38,3 +38,3 @@ })(doc);

var testEl = document.createElement('div');
testEl.innerHTML = 'Test: <script type=\'text/x-placeholder\'></script>Value';
testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value';

@@ -95,3 +95,3 @@ })(doc);

// At this point it's the actual unicode character.
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === '­') {
if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
var newValue = shyElement.nodeValue.slice(1);

@@ -114,3 +114,3 @@ if (newValue.length) {

if (!outerHTML) {
throw 'Can\'t set innerHTML on ' + tagName + ' in this browser';
throw "Can't set innerHTML on " + tagName + " in this browser";
}

@@ -122,3 +122,3 @@

var startTag = outerHTML.match(new RegExp('<' + tagName + '([^>]*)>', 'i'))[0];
var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0];
var endTag = '</' + tagName + '>';

@@ -171,3 +171,3 @@

if (contextualElement.tagName === 'SELECT') {
html = '<option></option>' + html;
html = "<option></option>" + html;
}

@@ -174,0 +174,0 @@

@@ -17,2 +17,3 @@ 'use strict';

*/
function normalizeProperty(element, slotName) {

@@ -19,0 +20,0 @@ var type, normalized;

@@ -29,3 +29,3 @@ 'use strict';

registerHelper("each", function (params) {
registerHelper('each', function (params) {
var list = params[0];

@@ -58,6 +58,6 @@

var morph = result.nodes[0].morphList.firstChildMorph;
morph.state.initialName = "A1";
morph.nextMorph.state.initialName = "A2";
morph.nextMorph.nextMorph.state.initialName = "B1";
morph.nextMorph.nextMorph.nextMorph.state.initialName = "B2";
morph.state.initialName = 'A1';
morph.nextMorph.state.initialName = 'A2';
morph.nextMorph.nextMorph.state.initialName = 'B1';
morph.nextMorph.nextMorph.nextMorph.state.initialName = 'B2';

@@ -79,3 +79,3 @@ function getNames() {

htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li>A1</li><li>B2</li><li>B1</li><li>A2</li></ul>");
deepEqual(getNames(), ["A1", "B1", "B2", "A2"]);
deepEqual(getNames(), ['A1', 'B1', 'B2', 'A2']);

@@ -85,3 +85,18 @@ result.rerender(env, { items: [b1, a2] });

htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li>B1</li><li>A2</li></ul>");
deepEqual(getNames(), ["B1", "A1"]);
deepEqual(getNames(), ['B1', 'A1']);
});
test("duplicate keys are allowed when duplicate is last morph", function () {
var template = compiler.compile("<ul>{{#each items as |item|}}<li>{{item.name}}</li>{{/each}}</ul>");
var a1 = { key: "a", name: "A1" };
var a2 = { key: "a", name: "A2" };
var result = template.render({ items: [] }, env);
result.rerender(env, { items: [a1] });
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li>A1</li></ul>");
result.rerender(env, { items: [a1, a2] });
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li>A1</li><li>A2</li></ul>");
});

@@ -31,3 +31,3 @@ 'use strict';

registerHelper("if", function (params, hash, options) {
registerHelper('if', function (params, hash, options) {
if (!!params[0]) {

@@ -40,3 +40,3 @@ return options.template.yield();

registerHelper("each", function (params) {
registerHelper('each', function (params) {
var list = params[0];

@@ -60,18 +60,18 @@

test("a simple implementation of a dirtying rerender", function () {
var object = { condition: true, value: "hello world" };
var template = compiler.compile("<div>{{#if condition}}<p>{{value}}</p>{{else}}<p>Nothing</p>{{/if}}</div>");
var object = { condition: true, value: 'hello world' };
var template = compiler.compile('<div>{{#if condition}}<p>{{value}}</p>{{else}}<p>Nothing</p>{{/if}}</div>');
var result = template.render(object, env);
var valueNode = result.fragment.firstChild.firstChild.firstChild;
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>hello world</p></div>", "Initial render");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>hello world</p></div>', "Initial render");
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>hello world</p></div>", "After dirtying but not updating");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>hello world</p></div>', "After dirtying but not updating");
strictEqual(result.fragment.firstChild.firstChild.firstChild, valueNode, "The text node was not blown away");
// Even though the #if was stable, a dirty child node is updated
object.value = "goodbye world";
object.value = 'goodbye world';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>goodbye world</p></div>", "After updating and dirtying");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>goodbye world</p></div>', "After updating and dirtying");
strictEqual(result.fragment.firstChild.firstChild.firstChild, valueNode, "The text node was not blown away");

@@ -82,7 +82,7 @@

result.revalidate();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>goodbye world</p></div>", "After flipping the condition but not dirtying");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>goodbye world</p></div>', "After flipping the condition but not dirtying");
strictEqual(result.fragment.firstChild.firstChild.firstChild, valueNode, "The text node was not blown away");
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>Nothing</p></div>", "And then dirtying");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>Nothing</p></div>', "And then dirtying");
QUnit.notStrictEqual(result.fragment.firstChild.firstChild.firstChild, valueNode, "The text node was not blown away");

@@ -92,7 +92,7 @@ });

test("a simple implementation of a dirtying rerender without inverse", function () {
var object = { condition: true, value: "hello world" };
var template = compiler.compile("<div>{{#if condition}}<p>{{value}}</p>{{/if}}</div>");
var object = { condition: true, value: 'hello world' };
var template = compiler.compile('<div>{{#if condition}}<p>{{value}}</p>{{/if}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>hello world</p></div>", "Initial render");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>hello world</p></div>', "Initial render");

@@ -103,3 +103,3 @@ // Should not update since render node is not marked as dirty

result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><!----></div>", "If the condition is false, the morph becomes empty");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><!----></div>', "If the condition is false, the morph becomes empty");

@@ -109,3 +109,3 @@ object.condition = true;

result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>hello world</p></div>", "If the condition is false, the morph becomes empty");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>hello world</p></div>', "If the condition is false, the morph becomes empty");
});

@@ -125,7 +125,7 @@

var valueNode = getValueNode();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>Hello world</p></div>');
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>Hello world</p></div>');
strictEqual(getValueNode(), valueNode);

@@ -136,3 +136,3 @@

result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p>Goodbye world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p>Goodbye world</p></div>');
strictEqual(getValueNode(), valueNode);

@@ -158,6 +158,6 @@

var titleNode = getTitleNode();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Hello world</p></div>');
rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Hello world</p></div>');
assertStableNodes();

@@ -168,3 +168,3 @@

rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Goodbye world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Goodbye world</p></div>');
assertStableNodes();

@@ -203,6 +203,6 @@

var titleNode = getTitleNode();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Hello world</p></div>');
rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Hello world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Hello world</p></div>');
assertStableNodes();

@@ -213,3 +213,3 @@

rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Yo! </span>Goodbye world</p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Yo! </span>Goodbye world</p></div>');
assertStableNodes();

@@ -236,3 +236,3 @@

test("block helpers whose template has a morph at the edge", function () {
registerHelper("id", function (params, hash, options) {
registerHelper('id', function (params, hash, options) {
return options.template.yield();

@@ -245,3 +245,3 @@ });

htmlbars_test_helpers.equalTokens(result.fragment, "hello world");
htmlbars_test_helpers.equalTokens(result.fragment, 'hello world');
var firstNode = result.root.firstNode;

@@ -281,3 +281,3 @@ equal(firstNode.nodeType, 3, "first node of the parent template");

htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');

@@ -295,3 +295,3 @@ var textRenderNode = result.root.childNodes[0];

test("helper calls follow the normal dirtying rules", function () {
registerHelper("capitalize", function (params) {
registerHelper('capitalize', function (params) {
return params[0].toUpperCase();

@@ -310,3 +310,3 @@ });

htmlbars_test_helpers.equalTokens(result.fragment, "<div>HELLO</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>HELLO</div>');

@@ -317,3 +317,3 @@ var textRenderNode = result.root.childNodes[0];

htmlbars_test_helpers.equalTokens(result.fragment, "<div>GOODBYE</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>GOODBYE</div>');

@@ -392,4 +392,4 @@ textRenderNode.setContent = function () {

var itemNode = getItemNode("tomdale");
var nameNode = getNameNode("tomdale");
var itemNode = getItemNode('tomdale');
var nameNode = getNameNode('tomdale');

@@ -399,7 +399,7 @@ htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='tomdale'>Tom Dale</li><li class='wycats'>Yehuda Katz</li></ul>", "Initial render");

rerender();
assertStableNodes("tomdale", "after no-op rerender");
assertStableNodes('tomdale', "after no-op rerender");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='tomdale'>Tom Dale</li><li class='wycats'>Yehuda Katz</li></ul>", "After no-op re-render");
result.revalidate();
assertStableNodes("tomdale", "after non-dirty rerender");
assertStableNodes('tomdale', "after non-dirty rerender");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='tomdale'>Tom Dale</li><li class='wycats'>Yehuda Katz</li></ul>", "After no-op re-render");

@@ -409,3 +409,3 @@

rerender(object);
assertStableNodes("tomdale", "after changing the list order");
assertStableNodes('tomdale', "after changing the list order");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='wycats'>Yehuda Katz</li><li class='tomdale'>Tom Dale</li></ul>", "After changing the list order");

@@ -415,3 +415,3 @@

rerender(object);
assertStableNodes("mmun", "after changing the list entries, but with stable keys");
assertStableNodes('mmun', "after changing the list entries, but with stable keys");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li><li class='krisselden'>Kris Selden</li></ul>", "After changing the list entries, but with stable keys");

@@ -422,3 +422,3 @@

rerender(object);
assertStableNodes("mmun", "after adding an additional entry");
assertStableNodes('mmun', "after adding an additional entry");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li><li class='krisselden'>Kristoph Selden</li><li class='mixonic'>Matthew Beale</li></ul>", "After adding an additional entry");

@@ -429,3 +429,3 @@

rerender(object);
assertStableNodes("mmun", "after removing the middle entry");
assertStableNodes('mmun', "after removing the middle entry");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li><li class='mixonic'>Matthew Beale</li></ul>", "after removing the middle entry");

@@ -436,8 +436,8 @@

rerender(object);
assertStableNodes("mmun", "after adding two more entries");
assertStableNodes('mmun', "after adding two more entries");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li><li class='stefanpenner'>Stefan Penner</li><li class='rwjblue'>Robert Jackson</li></ul>", "After adding two more entries");
// New node for stability check
itemNode = getItemNode("rwjblue");
nameNode = getNameNode("rwjblue");
itemNode = getItemNode('rwjblue');
nameNode = getNameNode('rwjblue');

@@ -447,3 +447,3 @@ object = { list: [{ key: "5", name: "Robert Jackson", "class": "rwjblue" }] };

rerender(object);
assertStableNodes("rwjblue", "after removing two entries");
assertStableNodes('rwjblue', "after removing two entries");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='rwjblue'>Robert Jackson</li></ul>", "After removing two entries");

@@ -454,8 +454,8 @@

rerender(object);
assertStableNodes("rwjblue", "after adding back entries");
assertStableNodes('rwjblue', "after adding back entries");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li><li class='stefanpenner'>Stefan Penner</li><li class='rwjblue'>Robert Jackson</li></ul>", "After adding back entries");
// New node for stability check
itemNode = getItemNode("mmun");
nameNode = getNameNode("mmun");
itemNode = getItemNode('mmun');
nameNode = getNameNode('mmun');

@@ -465,3 +465,3 @@ object = { list: [{ key: "1", name: "Martin Muñoz", "class": "mmun" }] };

rerender(object);
assertStableNodes("mmun", "after removing from the back");
assertStableNodes('mmun', "after removing from the back");
htmlbars_test_helpers.equalTokens(result.fragment, "<ul><li class='mmun'>Martin Muñoz</li></ul>", "After removing from the back");

@@ -489,3 +489,3 @@

while (itemNode) {
if (itemNode.getAttribute("class") === className) {
if (itemNode.getAttribute('class') === className) {
break;

@@ -561,4 +561,4 @@ }

test("Pruned render nodes invoke a cleanup hook when replaced", function () {
var object = { condition: true, value: "hello world", falsy: "Nothing" };
var template = compiler.compile("<div>{{#if condition}}<p>{{value}}</p>{{else}}<p>{{falsy}}</p>{{/if}}</div>");
var object = { condition: true, value: 'hello world', falsy: "Nothing" };
var template = compiler.compile('<div>{{#if condition}}<p>{{value}}</p>{{else}}<p>{{falsy}}</p>{{/if}}</div>');

@@ -573,3 +573,3 @@ var result = template.render(object, env);

strictEqual(destroyedRenderNodeCount, 1, "cleanup hook was invoked once");
strictEqual(destroyedRenderNode.lastValue, "hello world", "The correct render node is passed in");
strictEqual(destroyedRenderNode.lastValue, 'hello world', "The correct render node is passed in");

@@ -580,8 +580,8 @@ object.condition = true;

strictEqual(destroyedRenderNodeCount, 2, "cleanup hook was invoked again");
strictEqual(destroyedRenderNode.lastValue, "Nothing", "The correct render node is passed in");
strictEqual(destroyedRenderNode.lastValue, 'Nothing', "The correct render node is passed in");
});
test("Pruned render nodes invoke a cleanup hook when cleared", function () {
var object = { condition: true, value: "hello world" };
var template = compiler.compile("<div>{{#if condition}}<p>{{value}}</p>{{/if}}</div>");
var object = { condition: true, value: 'hello world' };
var template = compiler.compile('<div>{{#if condition}}<p>{{value}}</p>{{/if}}</div>');

@@ -596,3 +596,3 @@ var result = template.render(object, env);

strictEqual(destroyedRenderNodeCount, 1, "cleanup hook was invoked once");
strictEqual(destroyedRenderNode.lastValue, "hello world", "The correct render node is passed in");
strictEqual(destroyedRenderNode.lastValue, 'hello world', "The correct render node is passed in");

@@ -607,3 +607,3 @@ object.condition = true;

var object = { list: [{ key: "1", word: "hello" }, { key: "2", word: "world" }] };
var template = compiler.compile("<div>{{#each list as |item|}}<p>{{item.word}}</p>{{/each}}</div>");
var template = compiler.compile('<div>{{#each list as |item|}}<p>{{item.word}}</p>{{/each}}</div>');

@@ -629,3 +629,3 @@ var result = template.render(object, env);

var object = { list: [{ key: "1", word: "hello" }, { key: "2", word: "world" }] };
var template = compiler.compile("<div>{{#each list as |item|}}<p>{{#if item.word}}{{item.word}}{{/if}}</p>{{/each}}</div>");
var template = compiler.compile('<div>{{#each list as |item|}}<p>{{#if item.word}}{{item.word}}{{/if}}</p>{{/each}}</div>');

@@ -654,11 +654,11 @@ var result = template.render(object, env);

test("Setting up a manual element renders and revalidates", function () {
hooks.keywords["manual-element"] = {
hooks.keywords['manual-element'] = {
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
var attributes = {
title: "Tom Dale",
href: ["concat", ["http://tomdale.", ["get", "tld"]]],
"data-bar": ["get", "bar"]
href: ['concat', ['http://tomdale.', ['get', 'tld']]],
'data-bar': ['get', 'bar']
};
var layout = render.manualElement("span", attributes);
var layout = render.manualElement('span', attributes);

@@ -669,3 +669,3 @@ defaultHooks.hostBlock(morph, env, scope, template, inverse, null, visitor, function (options) {

render.manualElement(env, scope, "span", attributes, morph);
render.manualElement(env, scope, 'span', attributes, morph);
},

@@ -685,11 +685,11 @@

test("It is possible to nest multiple templates into a manual element", function () {
hooks.keywords["manual-element"] = {
hooks.keywords['manual-element'] = {
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
var attributes = {
title: "Tom Dale",
href: ["concat", ["http://tomdale.", ["get", "tld"]]],
"data-bar": ["get", "bar"]
href: ['concat', ['http://tomdale.', ['get', 'tld']]],
'data-bar': ['get', 'bar']
};
var elementTemplate = render.manualElement("span", attributes);
var elementTemplate = render.manualElement('span', attributes);

@@ -696,0 +696,0 @@ var contentBlock = template_utils.blockFor(render['default'], template, { scope: scope });

@@ -20,3 +20,3 @@ 'use strict';

var fn = new Function("dom", "return " + program)();
var fn = new Function("dom", 'return ' + program)();

@@ -26,5 +26,5 @@ return fn(new DOMHelper['default']());

QUnit.module("fragment");
QUnit.module('fragment');
test("compiles a fragment", function () {
test('compiles a fragment', function () {
var ast = parser.preprocess("<div>{{foo}} bar {{baz}}</div>");

@@ -37,39 +37,39 @@ var divNode = fragmentFor(ast).firstChild;

if (document && document.createElementNS) {
test("compiles an svg fragment", function () {
test('compiles an svg fragment', function () {
var ast = parser.preprocess("<div><svg><circle/><foreignObject><span></span></foreignObject></svg></div>");
var divNode = fragmentFor(ast).firstChild;
equal(divNode.childNodes[0].namespaceURI, svgNamespace, "svg has the right namespace");
equal(divNode.childNodes[0].childNodes[0].namespaceURI, svgNamespace, "circle has the right namespace");
equal(divNode.childNodes[0].childNodes[1].namespaceURI, svgNamespace, "foreignObject has the right namespace");
equal(divNode.childNodes[0].childNodes[1].childNodes[0].namespaceURI, xhtmlNamespace, "span has the right namespace");
equal(divNode.childNodes[0].namespaceURI, svgNamespace, 'svg has the right namespace');
equal(divNode.childNodes[0].childNodes[0].namespaceURI, svgNamespace, 'circle has the right namespace');
equal(divNode.childNodes[0].childNodes[1].namespaceURI, svgNamespace, 'foreignObject has the right namespace');
equal(divNode.childNodes[0].childNodes[1].childNodes[0].namespaceURI, xhtmlNamespace, 'span has the right namespace');
});
}
test("compiles an svg element with classes", function () {
var ast = parser.preprocess("<svg class=\"red right hand\"></svg>");
test('compiles an svg element with classes', function () {
var ast = parser.preprocess('<svg class="red right hand"></svg>');
var svgNode = fragmentFor(ast).firstChild;
equal(svgNode.getAttribute("class"), "red right hand");
equal(svgNode.getAttribute('class'), 'red right hand');
});
if (document && document.createElementNS) {
test("compiles an svg element with proper namespace", function () {
var ast = parser.preprocess("<svg><use xlink:title=\"nice-title\"></use></svg>");
test('compiles an svg element with proper namespace', function () {
var ast = parser.preprocess('<svg><use xlink:title="nice-title"></use></svg>');
var svgNode = fragmentFor(ast).firstChild;
equal(svgNode.childNodes[0].getAttributeNS("http://www.w3.org/1999/xlink", "title"), "nice-title");
equal(svgNode.childNodes[0].attributes[0].namespaceURI, "http://www.w3.org/1999/xlink");
equal(svgNode.childNodes[0].attributes[0].name, "xlink:title");
equal(svgNode.childNodes[0].attributes[0].localName, "title");
equal(svgNode.childNodes[0].attributes[0].value, "nice-title");
equal(svgNode.childNodes[0].getAttributeNS('http://www.w3.org/1999/xlink', 'title'), 'nice-title');
equal(svgNode.childNodes[0].attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink');
equal(svgNode.childNodes[0].attributes[0].name, 'xlink:title');
equal(svgNode.childNodes[0].attributes[0].localName, 'title');
equal(svgNode.childNodes[0].attributes[0].value, 'nice-title');
});
}
test("converts entities to their char/string equivalent", function () {
test('converts entities to their char/string equivalent', function () {
var ast = parser.preprocess("<div title=\"&quot;Foo &amp; Bar&quot;\">lol &lt; &#60;&#x3c; &#x3C; &LT; &NotGreaterFullEqual; &Borksnorlax;</div>");
var divNode = fragmentFor(ast).firstChild;
equal(divNode.getAttribute("title"), "\"Foo & Bar\"");
equal(divNode.getAttribute('title'), '"Foo & Bar"');
equal(htmlbars_test_helpers.getTextContent(divNode), "lol < << < < ≧̸ &Borksnorlax;");
});

@@ -51,13 +51,13 @@ 'use strict';

registerHelper("print", function (params) {
return params.join("");
registerHelper('print', function (params) {
return params.join('');
});
var object = { val: "hello world" };
var template = compiler.compile("<div>{{print val}}</div>");
var object = { val: 'hello world' };
var template = compiler.compile('<div>{{print val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello world</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello world</div>');
ok(invoked, "The invokeHelper hook was invoked");
});

@@ -79,3 +79,3 @@ 'use strict';

htmlbars_test_helpers.equalTokens(fragment, "<div class=\"foo\" id=\"bar\">content</div>");
htmlbars_test_helpers.equalTokens(fragment, '<div class="foo" id="bar">content</div>');
});

@@ -87,47 +87,47 @@

htmlbars_test_helpers.equalTokens(fragment, "<div class=\"\">content</div>");
htmlbars_test_helpers.equalTokens(fragment, '<div class="">content</div>');
});
test("presence of `disabled` attribute without value marks as disabled", function () {
var template = compiler.compile("<input disabled>");
var template = compiler.compile('<input disabled>');
var inputNode = template.render({}, env).fragment.firstChild;
ok(inputNode.disabled, "disabled without value set as property is true");
ok(inputNode.disabled, 'disabled without value set as property is true');
});
test("Null quoted attribute value calls toString on the value", function () {
var template = compiler.compile("<input disabled=\"{{isDisabled}}\">");
var template = compiler.compile('<input disabled="{{isDisabled}}">');
var inputNode = template.render({ isDisabled: null }, env).fragment.firstChild;
ok(inputNode.disabled, "string of \"null\" set as property is true");
ok(inputNode.disabled, 'string of "null" set as property is true');
});
test("Null unquoted attribute value removes that attribute", function () {
var template = compiler.compile("<input disabled={{isDisabled}}>");
var template = compiler.compile('<input disabled={{isDisabled}}>');
var inputNode = template.render({ isDisabled: null }, env).fragment.firstChild;
htmlbars_test_helpers.equalTokens(inputNode, "<input>");
htmlbars_test_helpers.equalTokens(inputNode, '<input>');
});
test("unquoted attribute string is just that", function () {
var template = compiler.compile("<input value=funstuff>");
var template = compiler.compile('<input value=funstuff>');
var inputNode = template.render({}, env).fragment.firstChild;
equal(inputNode.tagName, "INPUT", "input tag");
equal(inputNode.value, "funstuff", "value is set as property");
equal(inputNode.tagName, 'INPUT', 'input tag');
equal(inputNode.value, 'funstuff', 'value is set as property');
});
test("unquoted attribute expression is string", function () {
var template = compiler.compile("<input value={{funstuff}}>");
var template = compiler.compile('<input value={{funstuff}}>');
var inputNode = template.render({ funstuff: "oh my" }, env).fragment.firstChild;
equal(inputNode.tagName, "INPUT", "input tag");
equal(inputNode.value, "oh my", "string is set to property");
equal(inputNode.tagName, 'INPUT', 'input tag');
equal(inputNode.value, 'oh my', 'string is set to property');
});
test("unquoted attribute expression works when followed by another attribute", function () {
var template = compiler.compile("<div foo={{funstuff}} name=\"Alice\"></div>");
var template = compiler.compile('<div foo={{funstuff}} name="Alice"></div>');
var divNode = template.render({ funstuff: "oh my" }, env).fragment.firstChild;
htmlbars_test_helpers.equalTokens(divNode, "<div name=\"Alice\" foo=\"oh my\"></div>");
htmlbars_test_helpers.equalTokens(divNode, '<div name="Alice" foo="oh my"></div>');
});

@@ -139,12 +139,12 @@

QUnit.throws(function () {
compiler.compile("<img class=foo{{bar}}>");
compiler.compile('<img class=foo{{bar}}>');
}, expectedError(1));
QUnit.throws(function () {
compiler.compile("<img class={{foo}}{{bar}}>");
compiler.compile('<img class={{foo}}{{bar}}>');
}, expectedError(1));
QUnit.throws(function () {
compiler.compile("<img \nclass={{foo}}bar>");
compiler.compile('<img \nclass={{foo}}bar>');
}, expectedError(2));
QUnit.throws(function () {
compiler.compile("<div \nclass\n=\n{{foo}}&amp;bar ></div>");
compiler.compile('<div \nclass\n=\n{{foo}}&amp;bar ></div>');
}, expectedError(4));

@@ -160,3 +160,3 @@

var divNode = template.render({}, env).fragment.firstChild;
htmlbars_test_helpers.equalTokens(divNode, "<div data-some-data=\"foo\">content</div>");
htmlbars_test_helpers.equalTokens(divNode, '<div data-some-data="foo">content</div>');
});

@@ -167,4 +167,4 @@

var inputNode = template.render({}, env).fragment.firstChild;
equal(inputNode.tagName, "INPUT", "input tag");
equal(inputNode.checked, true, "input tag is checked");
equal(inputNode.tagName, 'INPUT', 'input tag');
equal(inputNode.checked, true, 'input tag is checked');
});

@@ -180,4 +180,4 @@

var tag = "<" + tagName + " data-foo=\"bar\">";
var closing = "</" + tagName + ">";
var tag = '<' + tagName + ' data-foo="bar">';
var closing = '</' + tagName + '>';
var extra = "<p>hello</p>";

@@ -198,3 +198,3 @@ html = htmlbars_test_helpers.normalizeInnerHTML(div.innerHTML);

test("The compiler can handle nesting", function () {
var html = "<div class=\"foo\"><p><span id=\"bar\" data-foo=\"bar\">hi!</span></p></div>&nbsp;More content";
var html = '<div class="foo"><p><span id="bar" data-foo="bar">hi!</span></p></div>&nbsp;More content';
var template = compiler.compile(html);

@@ -207,7 +207,7 @@ var fragment = template.render({}, env).fragment;

test("The compiler can handle quotes", function () {
compilesTo("<div>\"This is a title,\" we're on a boat</div>");
compilesTo('<div>"This is a title," we\'re on a boat</div>');
});
test("The compiler can handle backslashes", function () {
compilesTo("<div>This is a backslash: \\</div>");
compilesTo('<div>This is a backslash: \\</div>');
});

@@ -220,23 +220,23 @@

test("The compiler can handle comments", function () {
compilesTo("<div>{{! Better not break! }}content</div>", "<div>content</div>", {});
compilesTo("<div>{{! Better not break! }}content</div>", '<div>content</div>', {});
});
test("The compiler can handle HTML comments", function () {
compilesTo("<div><!-- Just passing through --></div>");
compilesTo('<div><!-- Just passing through --></div>');
});
test("The compiler can handle HTML comments with mustaches in them", function () {
compilesTo("<div><!-- {{foo}} --></div>", "<div><!-- {{foo}} --></div>", { foo: "bar" });
compilesTo('<div><!-- {{foo}} --></div>', '<div><!-- {{foo}} --></div>', { foo: 'bar' });
});
test("The compiler can handle HTML comments with complex mustaches in them", function () {
compilesTo("<div><!-- {{foo bar baz}} --></div>", "<div><!-- {{foo bar baz}} --></div>", { foo: "bar" });
compilesTo('<div><!-- {{foo bar baz}} --></div>', '<div><!-- {{foo bar baz}} --></div>', { foo: 'bar' });
});
test("The compiler can handle HTML comments with multi-line mustaches in them", function () {
compilesTo("<div><!-- {{#each foo as |bar|}}\n{{bar}}\n\n{{/each}} --></div>");
compilesTo('<div><!-- {{#each foo as |bar|}}\n{{bar}}\n\n{{/each}} --></div>');
});
test("The compiler can handle comments with no parent element", function () {
compilesTo("<!-- {{foo}} -->");
test('The compiler can handle comments with no parent element', function () {
compilesTo('<!-- {{foo}} -->');
});

@@ -251,81 +251,81 @@

test("The compiler can handle partials in helper partial syntax", function () {
registerPartial("partial_name", "<b>Partial Works!</b>");
compilesTo("<div>{{partial \"partial_name\"}} Plaintext content</div>", "<div><b>Partial Works!</b> Plaintext content</div>", {});
registerPartial('partial_name', "<b>Partial Works!</b>");
compilesTo('<div>{{partial "partial_name"}} Plaintext content</div>', '<div><b>Partial Works!</b> Plaintext content</div>', {});
});
test("The compiler can handle simple handlebars", function () {
compilesTo("<div>{{title}}</div>", "<div>hello</div>", { title: "hello" });
compilesTo('<div>{{title}}</div>', '<div>hello</div>', { title: 'hello' });
});
test("The compiler can handle escaping HTML", function () {
compilesTo("<div>{{title}}</div>", "<div>&lt;strong&gt;hello&lt;/strong&gt;</div>", { title: "<strong>hello</strong>" });
compilesTo('<div>{{title}}</div>', '<div>&lt;strong&gt;hello&lt;/strong&gt;</div>', { title: '<strong>hello</strong>' });
});
test("The compiler can handle unescaped HTML", function () {
compilesTo("<div>{{{title}}}</div>", "<div><strong>hello</strong></div>", { title: "<strong>hello</strong>" });
compilesTo('<div>{{{title}}}</div>', '<div><strong>hello</strong></div>', { title: '<strong>hello</strong>' });
});
test("The compiler can handle top-level unescaped HTML", function () {
compilesTo("{{{html}}}", "<strong>hello</strong>", { html: "<strong>hello</strong>" });
compilesTo('{{{html}}}', '<strong>hello</strong>', { html: '<strong>hello</strong>' });
});
test("The compiler can handle top-level unescaped tr", function () {
var template = compiler.compile("{{{html}}}");
var context = { html: "<tr><td>Yo</td></tr>" };
var fragment = template.render(context, env, { contextualElement: document.createElement("table") }).fragment;
var template = compiler.compile('{{{html}}}');
var context = { html: '<tr><td>Yo</td></tr>' };
var fragment = template.render(context, env, { contextualElement: document.createElement('table') }).fragment;
equal(fragment.firstChild.nextSibling.tagName, "TR", "root tr is present");
equal(fragment.firstChild.nextSibling.tagName, 'TR', "root tr is present");
});
test("The compiler can handle top-level unescaped td inside tr contextualElement", function () {
var template = compiler.compile("{{{html}}}");
var context = { html: "<td>Yo</td>" };
var fragment = template.render(context, env, { contextualElement: document.createElement("tr") }).fragment;
var template = compiler.compile('{{{html}}}');
var context = { html: '<td>Yo</td>' };
var fragment = template.render(context, env, { contextualElement: document.createElement('tr') }).fragment;
equal(fragment.firstChild.nextSibling.tagName, "TD", "root td is returned");
equal(fragment.firstChild.nextSibling.tagName, 'TD', "root td is returned");
});
test("The compiler can handle unescaped tr in top of content", function () {
registerHelper("test", function () {
registerHelper('test', function () {
return this.yield();
});
var template = compiler.compile("{{#test}}{{{html}}}{{/test}}");
var context = { html: "<tr><td>Yo</td></tr>" };
var fragment = template.render(context, env, { contextualElement: document.createElement("table") }).fragment;
var template = compiler.compile('{{#test}}{{{html}}}{{/test}}');
var context = { html: '<tr><td>Yo</td></tr>' };
var fragment = template.render(context, env, { contextualElement: document.createElement('table') }).fragment;
equal(fragment.firstChild.nextSibling.nextSibling.tagName, "TR", "root tr is present");
equal(fragment.firstChild.nextSibling.nextSibling.tagName, 'TR', "root tr is present");
});
test("The compiler can handle unescaped tr inside fragment table", function () {
registerHelper("test", function () {
registerHelper('test', function () {
return this.yield();
});
var template = compiler.compile("<table>{{#test}}{{{html}}}{{/test}}</table>");
var context = { html: "<tr><td>Yo</td></tr>" };
var fragment = template.render(context, env, { contextualElement: document.createElement("div") }).fragment;
var template = compiler.compile('<table>{{#test}}{{{html}}}{{/test}}</table>');
var context = { html: '<tr><td>Yo</td></tr>' };
var fragment = template.render(context, env, { contextualElement: document.createElement('div') }).fragment;
var tableNode = fragment.firstChild;
equal(tableNode.firstChild.nextSibling.tagName, "TR", "root tr is present");
equal(tableNode.firstChild.nextSibling.tagName, 'TR', "root tr is present");
});
test("The compiler can handle simple helpers", function () {
registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
return params[0];
});
compilesTo("<div>{{testing title}}</div>", "<div>hello</div>", { title: "hello" });
compilesTo('<div>{{testing title}}</div>', '<div>hello</div>', { title: 'hello' });
});
test("Helpers propagate the owner render node", function () {
registerHelper("id", function () {
registerHelper('id', function () {
return this.yield();
});
var template = compiler.compile("<div>{{#id}}<p>{{#id}}<span>{{#id}}{{name}}{{/id}}</span>{{/id}}</p>{{/id}}</div>");
var template = compiler.compile('<div>{{#id}}<p>{{#id}}<span>{{#id}}{{name}}{{/id}}</span>{{/id}}</p>{{/id}}</div>');
var context = { name: "Tom Dale" };
var result = template.render(context, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div><p><span>Tom Dale</span></p></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div><p><span>Tom Dale</span></p></div>');

@@ -339,40 +339,40 @@ var root = result.root;

test("The compiler can handle sexpr helpers", function () {
registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
return params[0] + "!";
});
compilesTo("<div>{{testing (testing \"hello\")}}</div>", "<div>hello!!</div>", {});
compilesTo('<div>{{testing (testing "hello")}}</div>', '<div>hello!!</div>', {});
});
test("The compiler can handle multiple invocations of sexprs", function () {
registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
return "" + params[0] + params[1];
});
compilesTo("<div>{{testing (testing \"hello\" foo) (testing (testing bar \"lol\") baz)}}</div>", "<div>helloFOOBARlolBAZ</div>", { foo: "FOO", bar: "BAR", baz: "BAZ" });
compilesTo('<div>{{testing (testing "hello" foo) (testing (testing bar "lol") baz)}}</div>', '<div>helloFOOBARlolBAZ</div>', { foo: "FOO", bar: "BAR", baz: "BAZ" });
});
test("The compiler passes along the hash arguments", function () {
registerHelper("testing", function (params, hash) {
return hash.first + "-" + hash.second;
registerHelper('testing', function (params, hash) {
return hash.first + '-' + hash.second;
});
compilesTo("<div>{{testing first=\"one\" second=\"two\"}}</div>", "<div>one-two</div>");
compilesTo('<div>{{testing first="one" second="two"}}</div>', '<div>one-two</div>');
});
test("second render respects whitespace", function () {
var template = compiler.compile("Hello {{ foo }} ");
template.render({}, env, { contextualElement: document.createElement("div") });
var fragment = template.render({}, env, { contextualElement: document.createElement("div") }).fragment;
equal(fragment.childNodes.length, 3, "fragment contains 3 text nodes");
equal(htmlbars_test_helpers.getTextContent(fragment.childNodes[0]), "Hello ", "first text node ends with one space character");
equal(htmlbars_test_helpers.getTextContent(fragment.childNodes[2]), " ", "last text node contains one space character");
var template = compiler.compile('Hello {{ foo }} ');
template.render({}, env, { contextualElement: document.createElement('div') });
var fragment = template.render({}, env, { contextualElement: document.createElement('div') }).fragment;
equal(fragment.childNodes.length, 3, 'fragment contains 3 text nodes');
equal(htmlbars_test_helpers.getTextContent(fragment.childNodes[0]), 'Hello ', 'first text node ends with one space character');
equal(htmlbars_test_helpers.getTextContent(fragment.childNodes[2]), ' ', 'last text node contains one space character');
});
test("Morphs are escaped correctly", function () {
registerHelper("testing-unescaped", function (params) {
registerHelper('testing-unescaped', function (params) {
return params[0];
});
registerHelper("testing-escaped", function (params) {
registerHelper('testing-escaped', function (params) {
if (this.yield) {

@@ -385,10 +385,10 @@ return this.yield();

compilesTo("<div>{{{testing-unescaped \"<span>hi</span>\"}}}</div>", "<div><span>hi</span></div>");
compilesTo("<div>{{testing-escaped \"<hi>\"}}</div>", "<div>&lt;hi&gt;</div>");
compilesTo("<div>{{#testing-escaped}}<em></em>{{/testing-escaped}}</div>", "<div><em></em></div>");
compilesTo("<div><testing-escaped><em></em></testing-escaped></div>", "<div><em></em></div>");
compilesTo('<div>{{{testing-unescaped "<span>hi</span>"}}}</div>', '<div><span>hi</span></div>');
compilesTo('<div>{{testing-escaped "<hi>"}}</div>', '<div>&lt;hi&gt;</div>');
compilesTo('<div>{{#testing-escaped}}<em></em>{{/testing-escaped}}</div>', '<div><em></em></div>');
compilesTo('<div><testing-escaped><em></em></testing-escaped></div>', '<div><em></em></div>');
});
test("Attributes can use computed values", function () {
compilesTo("<a href=\"{{url}}\">linky</a>", "<a href=\"linky.html\">linky</a>", { url: "linky.html" });
compilesTo('<a href="{{url}}">linky</a>', '<a href="linky.html">linky</a>', { url: 'linky.html' });
});

@@ -398,10 +398,10 @@

var context = { foo: "FOO", bar: "BAR", baz: "BAZ", boo: "BOO", brew: "BREW", bat: "BAT", flute: "FLUTE", argh: "ARGH" };
compilesTo("{{foo}}<span></span>", "FOO<span></span>", context);
compilesTo("<span></span>{{foo}}", "<span></span>FOO", context);
compilesTo("<span>{{foo}}</span>{{foo}}", "<span>FOO</span>FOO", context);
compilesTo("{{foo}}<span>{{foo}}</span>{{foo}}", "FOO<span>FOO</span>FOO", context);
compilesTo("{{foo}}<span></span>{{foo}}", "FOO<span></span>FOO", context);
compilesTo("{{foo}}<span></span>{{bar}}<span><span><span>{{baz}}</span></span></span>", "FOO<span></span>BAR<span><span><span>BAZ</span></span></span>", context);
compilesTo("{{foo}}<span></span>{{bar}}<span>{{argh}}<span><span>{{baz}}</span></span></span>", "FOO<span></span>BAR<span>ARGH<span><span>BAZ</span></span></span>", context);
compilesTo("{{foo}}<span>{{bar}}<a>{{baz}}<em>{{boo}}{{brew}}</em>{{bat}}</a></span><span><span>{{flute}}</span></span>{{argh}}", "FOO<span>BAR<a>BAZ<em>BOOBREW</em>BAT</a></span><span><span>FLUTE</span></span>ARGH", context);
compilesTo('{{foo}}<span></span>', 'FOO<span></span>', context);
compilesTo('<span></span>{{foo}}', '<span></span>FOO', context);
compilesTo('<span>{{foo}}</span>{{foo}}', '<span>FOO</span>FOO', context);
compilesTo('{{foo}}<span>{{foo}}</span>{{foo}}', 'FOO<span>FOO</span>FOO', context);
compilesTo('{{foo}}<span></span>{{foo}}', 'FOO<span></span>FOO', context);
compilesTo('{{foo}}<span></span>{{bar}}<span><span><span>{{baz}}</span></span></span>', 'FOO<span></span>BAR<span><span><span>BAZ</span></span></span>', context);
compilesTo('{{foo}}<span></span>{{bar}}<span>{{argh}}<span><span>{{baz}}</span></span></span>', 'FOO<span></span>BAR<span>ARGH<span><span>BAZ</span></span></span>', context);
compilesTo('{{foo}}<span>{{bar}}<a>{{baz}}<em>{{boo}}{{brew}}</em>{{bat}}</a></span><span><span>{{flute}}</span></span>{{argh}}', 'FOO<span>BAR<a>BAZ<em>BOOBREW</em>BAT</a></span><span><span>FLUTE</span></span>ARGH', context);
});

@@ -441,7 +441,7 @@

test("Attributes can be populated with helpers that generate a string", function () {
registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
return params[0];
});
compilesTo("<a href=\"{{testing url}}\">linky</a>", "<a href=\"linky.html\">linky</a>", { url: "linky.html" });
compilesTo('<a href="{{testing url}}">linky</a>', '<a href="linky.html">linky</a>', { url: 'linky.html' });
});

@@ -458,7 +458,7 @@ /*

test("Attribute helpers take a hash", function () {
registerHelper("testing", function (params, hash) {
registerHelper('testing', function (params, hash) {
return hash.path;
});
compilesTo("<a href=\"{{testing path=url}}\">linky</a>", "<a href=\"linky.html\">linky</a>", { url: "linky.html" });
compilesTo('<a href="{{testing path=url}}">linky</a>', '<a href="linky.html">linky</a>', { url: 'linky.html' });
});

@@ -485,7 +485,7 @@ /*

test("Attributes containing multiple helpers are treated like a block", function () {
registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
return params[0];
});
compilesTo("<a href=\"http://{{foo}}/{{testing bar}}/{{testing \"baz\"}}\">linky</a>", "<a href=\"http://foo.com/bar/baz\">linky</a>", { foo: "foo.com", bar: "bar" });
compilesTo('<a href="http://{{foo}}/{{testing bar}}/{{testing "baz"}}">linky</a>', '<a href="http://foo.com/bar/baz">linky</a>', { foo: 'foo.com', bar: 'bar' });
});

@@ -496,3 +496,3 @@

registerHelper("testing", function (params) {
registerHelper('testing', function (params) {
deepEqual(params, [123]);

@@ -502,3 +502,3 @@ return "example.com";

compilesTo("<a href=\"http://{{testing 123}}/index.html\">linky</a>", "<a href=\"http://example.com/index.html\">linky</a>", { person: { url: "example.com" } });
compilesTo('<a href="http://{{testing 123}}/index.html">linky</a>', '<a href="http://example.com/index.html">linky</a>', { person: { url: 'example.com' } });
});

@@ -583,7 +583,7 @@ /*

test("A simple block helper can return the default document fragment", function () {
registerHelper("testing", function () {
registerHelper('testing', function () {
return this.yield();
});
compilesTo("{{#testing}}<div id=\"test\">123</div>{{/testing}}", "<div id=\"test\">123</div>");
compilesTo('{{#testing}}<div id="test">123</div>{{/testing}}', '<div id="test">123</div>');
});

@@ -593,28 +593,28 @@

test("A simple block helper can return text", function () {
registerHelper("testing", function () {
registerHelper('testing', function () {
return this.yield();
});
compilesTo("{{#testing}}test{{else}}not shown{{/testing}}", "test");
compilesTo('{{#testing}}test{{else}}not shown{{/testing}}', 'test');
});
test("A block helper can have an else block", function () {
registerHelper("testing", function (params, hash, options) {
registerHelper('testing', function (params, hash, options) {
return options.inverse.yield();
});
compilesTo("{{#testing}}Nope{{else}}<div id=\"test\">123</div>{{/testing}}", "<div id=\"test\">123</div>");
compilesTo('{{#testing}}Nope{{else}}<div id="test">123</div>{{/testing}}', '<div id="test">123</div>');
});
test("A block helper can pass a context to be used in the child", function () {
registerHelper("testing", function (params, hash, options) {
var context = { title: "Rails is omakase" };
registerHelper('testing', function (params, hash, options) {
var context = { title: 'Rails is omakase' };
return options.template.render(context);
});
compilesTo("{{#testing}}<div id=\"test\">{{title}}</div>{{/testing}}", "<div id=\"test\">Rails is omakase</div>");
compilesTo('{{#testing}}<div id="test">{{title}}</div>{{/testing}}', '<div id="test">Rails is omakase</div>');
});
test("Block helpers receive hash arguments", function () {
registerHelper("testing", function (params, hash) {
registerHelper('testing', function (params, hash) {
if (hash.truth) {

@@ -625,63 +625,63 @@ return this.yield();

compilesTo("{{#testing truth=true}}<p>Yep!</p>{{/testing}}{{#testing truth=false}}<p>Nope!</p>{{/testing}}", "<p>Yep!</p><!---->");
compilesTo('{{#testing truth=true}}<p>Yep!</p>{{/testing}}{{#testing truth=false}}<p>Nope!</p>{{/testing}}', '<p>Yep!</p><!---->');
});
test("Node helpers can modify the node", function () {
registerHelper("testing", function (params, hash, options) {
options.element.setAttribute("zomg", "zomg");
registerHelper('testing', function (params, hash, options) {
options.element.setAttribute('zomg', 'zomg');
});
compilesTo("<div {{testing}}>Node helpers</div>", "<div zomg=\"zomg\">Node helpers</div>");
compilesTo('<div {{testing}}>Node helpers</div>', '<div zomg="zomg">Node helpers</div>');
});
test("Node helpers can modify the node after one node appended by top-level helper", function () {
registerHelper("top-helper", function () {
return document.createElement("span");
registerHelper('top-helper', function () {
return document.createElement('span');
});
registerHelper("attr-helper", function (params, hash, options) {
options.element.setAttribute("zomg", "zomg");
registerHelper('attr-helper', function (params, hash, options) {
options.element.setAttribute('zomg', 'zomg');
});
compilesTo("<div {{attr-helper}}>Node helpers</div>{{top-helper}}", "<div zomg=\"zomg\">Node helpers</div><span></span>");
compilesTo('<div {{attr-helper}}>Node helpers</div>{{top-helper}}', '<div zomg="zomg">Node helpers</div><span></span>');
});
test("Node helpers can modify the node after one node prepended by top-level helper", function () {
registerHelper("top-helper", function () {
return document.createElement("span");
registerHelper('top-helper', function () {
return document.createElement('span');
});
registerHelper("attr-helper", function (params, hash, options) {
options.element.setAttribute("zomg", "zomg");
registerHelper('attr-helper', function (params, hash, options) {
options.element.setAttribute('zomg', 'zomg');
});
compilesTo("{{top-helper}}<div {{attr-helper}}>Node helpers</div>", "<span></span><div zomg=\"zomg\">Node helpers</div>");
compilesTo('{{top-helper}}<div {{attr-helper}}>Node helpers</div>', '<span></span><div zomg="zomg">Node helpers</div>');
});
test("Node helpers can modify the node after many nodes returned from top-level helper", function () {
registerHelper("top-helper", function () {
registerHelper('top-helper', function () {
var frag = document.createDocumentFragment();
frag.appendChild(document.createElement("span"));
frag.appendChild(document.createElement("span"));
frag.appendChild(document.createElement('span'));
frag.appendChild(document.createElement('span'));
return frag;
});
registerHelper("attr-helper", function (params, hash, options) {
options.element.setAttribute("zomg", "zomg");
registerHelper('attr-helper', function (params, hash, options) {
options.element.setAttribute('zomg', 'zomg');
});
compilesTo("{{top-helper}}<div {{attr-helper}}>Node helpers</div>", "<span></span><span></span><div zomg=\"zomg\">Node helpers</div>");
compilesTo('{{top-helper}}<div {{attr-helper}}>Node helpers</div>', '<span></span><span></span><div zomg="zomg">Node helpers</div>');
});
test("Node helpers can be used for attribute bindings", function () {
registerHelper("testing", function (params, hash, options) {
registerHelper('testing', function (params, hash, options) {
var value = hash.href,
element = options.element;
element.setAttribute("href", value);
element.setAttribute('href', value);
});
var object = { url: "linky.html" };
var template = compiler.compile("<a {{testing href=url}}>linky</a>");
var object = { url: 'linky.html' };
var template = compiler.compile('<a {{testing href=url}}>linky</a>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<a href=\"linky.html\">linky</a>");
object.url = "zippy.html";
htmlbars_test_helpers.equalTokens(result.fragment, '<a href="linky.html">linky</a>');
object.url = 'zippy.html';

@@ -691,38 +691,38 @@ result.dirty();

htmlbars_test_helpers.equalTokens(result.fragment, "<a href=\"zippy.html\">linky</a>");
htmlbars_test_helpers.equalTokens(result.fragment, '<a href="zippy.html">linky</a>');
});
test("Components - Called as helpers", function () {
registerHelper("x-append", function (params, hash) {
test('Components - Called as helpers', function () {
registerHelper('x-append', function (params, hash) {
QUnit.deepEqual(hash, { text: "de" });
this.yield();
});
var object = { bar: "e", baz: "c" };
compilesTo("a<x-append text=\"d{{bar}}\">b{{baz}}</x-append>f", "abcf", object);
var object = { bar: 'e', baz: 'c' };
compilesTo('a<x-append text="d{{bar}}">b{{baz}}</x-append>f', 'abcf', object);
});
test("Components - Unknown helpers fall back to elements", function () {
var object = { size: "med", foo: "b" };
compilesTo("<x-bar class=\"btn-{{size}}\">a{{foo}}c</x-bar>", "<x-bar class=\"btn-med\">abc</x-bar>", object);
test('Components - Unknown helpers fall back to elements', function () {
var object = { size: 'med', foo: 'b' };
compilesTo('<x-bar class="btn-{{size}}">a{{foo}}c</x-bar>', '<x-bar class="btn-med">abc</x-bar>', object);
});
test("Components - Text-only attributes work", function () {
var object = { foo: "qux" };
compilesTo("<x-bar id=\"test\">{{foo}}</x-bar>", "<x-bar id=\"test\">qux</x-bar>", object);
test('Components - Text-only attributes work', function () {
var object = { foo: 'qux' };
compilesTo('<x-bar id="test">{{foo}}</x-bar>', '<x-bar id="test">qux</x-bar>', object);
});
test("Components - Empty components work", function () {
compilesTo("<x-bar></x-bar>", "<x-bar></x-bar>", {});
test('Components - Empty components work', function () {
compilesTo('<x-bar></x-bar>', '<x-bar></x-bar>', {});
});
test("Components - Text-only dashed attributes work", function () {
var object = { foo: "qux" };
compilesTo("<x-bar aria-label=\"foo\" id=\"test\">{{foo}}</x-bar>", "<x-bar aria-label=\"foo\" id=\"test\">qux</x-bar>", object);
test('Components - Text-only dashed attributes work', function () {
var object = { foo: 'qux' };
compilesTo('<x-bar aria-label="foo" id="test">{{foo}}</x-bar>', '<x-bar aria-label="foo" id="test">qux</x-bar>', object);
});
test("Repaired text nodes are ensured in the right place", function () {
test('Repaired text nodes are ensured in the right place', function () {
var object = { a: "A", b: "B", c: "C", d: "D" };
compilesTo("{{a}} {{b}}", "A B", object);
compilesTo("<div>{{a}}{{b}}{{c}}wat{{d}}</div>", "<div>ABCwatD</div>", object);
compilesTo("{{a}}{{b}}<img><img><img><img>", "AB<img><img><img><img>", object);
compilesTo('{{a}} {{b}}', 'A B', object);
compilesTo('<div>{{a}}{{b}}{{c}}wat{{d}}</div>', '<div>ABCwatD</div>', object);
compilesTo('{{a}}{{b}}<img><img><img><img>', 'AB<img><img><img><img>', object);
});

@@ -734,17 +734,17 @@

htmlbars_test_helpers.equalTokens(fragment, "<div aria-label=\"foo\">content</div>");
htmlbars_test_helpers.equalTokens(fragment, '<div aria-label="foo">content</div>');
});
test("Block params", function () {
registerHelper("a", function () {
registerHelper('a', function () {
this.yieldIn(compiler.compile("A({{yield 'W' 'X1'}})"));
});
registerHelper("b", function () {
registerHelper('b', function () {
this.yieldIn(compiler.compile("B({{yield 'X2' 'Y'}})"));
});
registerHelper("c", function () {
registerHelper('c', function () {
this.yieldIn(compiler.compile("C({{yield 'Z'}})"));
});
var t = "{{#a as |w x|}}{{w}},{{x}} {{#b as |x y|}}{{x}},{{y}}{{/b}} {{w}},{{x}} {{#c as |z|}}{{x}},{{z}}{{/c}}{{/a}}";
compilesTo(t, "A(W,X1 B(X2,Y) W,X1 C(X1,Z))", {});
var t = '{{#a as |w x|}}{{w}},{{x}} {{#b as |x y|}}{{x}},{{y}}{{/b}} {{w}},{{x}} {{#c as |z|}}{{x}},{{z}}{{/c}}{{/a}}';
compilesTo(t, 'A(W,X1 B(X2,Y) W,X1 C(X1,Z))', {});
});

@@ -755,68 +755,68 @@

registerHelper("count-block-params", function (params, hash, options) {
equal(options.template.arity, hash.count, "Helpers should receive the correct number of block params in options.template.blockParams.");
registerHelper('count-block-params', function (params, hash, options) {
equal(options.template.arity, hash.count, 'Helpers should receive the correct number of block params in options.template.blockParams.');
});
compiler.compile("{{#count-block-params count=0}}{{/count-block-params}}").render({}, env, { contextualElement: document.body });
compiler.compile("{{#count-block-params count=1 as |x|}}{{/count-block-params}}").render({}, env, { contextualElement: document.body });
compiler.compile("{{#count-block-params count=2 as |x y|}}{{/count-block-params}}").render({}, env, { contextualElement: document.body });
compiler.compile("{{#count-block-params count=3 as |x y z|}}{{/count-block-params}}").render({}, env, { contextualElement: document.body });
compiler.compile('{{#count-block-params count=0}}{{/count-block-params}}').render({}, env, { contextualElement: document.body });
compiler.compile('{{#count-block-params count=1 as |x|}}{{/count-block-params}}').render({}, env, { contextualElement: document.body });
compiler.compile('{{#count-block-params count=2 as |x y|}}{{/count-block-params}}').render({}, env, { contextualElement: document.body });
compiler.compile('{{#count-block-params count=3 as |x y z|}}{{/count-block-params}}').render({}, env, { contextualElement: document.body });
});
test("Block params in HTML syntax", function () {
test('Block params in HTML syntax', function () {
var layout = compiler.compile("BAR({{yield 'Xerxes' 'York' 'Zed'}})");
registerHelper("x-bar", function () {
registerHelper('x-bar', function () {
this.yieldIn(layout);
});
compilesTo("<x-bar as |x y zee|>{{zee}},{{y}},{{x}}</x-bar>", "BAR(Zed,York,Xerxes)", {});
compilesTo('<x-bar as |x y zee|>{{zee}},{{y}},{{x}}</x-bar>', 'BAR(Zed,York,Xerxes)', {});
});
test("Block params in HTML syntax - Throws exception if given zero parameters", function () {
test('Block params in HTML syntax - Throws exception if given zero parameters', function () {
expect(2);
QUnit.throws(function () {
compiler.compile("<x-bar as ||>foo</x-bar>");
compiler.compile('<x-bar as ||>foo</x-bar>');
}, /Cannot use zero block parameters: 'as \|\|'/);
QUnit.throws(function () {
compiler.compile("<x-bar as | |>foo</x-bar>");
compiler.compile('<x-bar as | |>foo</x-bar>');
}, /Cannot use zero block parameters: 'as \| \|'/);
});
test("Block params in HTML syntax - Works with a single parameter", function () {
registerHelper("x-bar", function () {
return this.yield(["Xerxes"]);
test('Block params in HTML syntax - Works with a single parameter', function () {
registerHelper('x-bar', function () {
return this.yield(['Xerxes']);
});
compilesTo("<x-bar as |x|>{{x}}</x-bar>", "Xerxes", {});
compilesTo('<x-bar as |x|>{{x}}</x-bar>', 'Xerxes', {});
});
test("Block params in HTML syntax - Works with other attributes", function () {
registerHelper("x-bar", function (params, hash) {
deepEqual(hash, { firstName: "Alice", lastName: "Smith" });
test('Block params in HTML syntax - Works with other attributes', function () {
registerHelper('x-bar', function (params, hash) {
deepEqual(hash, { firstName: 'Alice', lastName: 'Smith' });
});
compiler.compile("<x-bar firstName=\"Alice\" lastName=\"Smith\" as |x y|></x-bar>").render({}, env, { contextualElement: document.body });
compiler.compile('<x-bar firstName="Alice" lastName="Smith" as |x y|></x-bar>').render({}, env, { contextualElement: document.body });
});
test("Block params in HTML syntax - Ignores whitespace", function () {
test('Block params in HTML syntax - Ignores whitespace', function () {
expect(3);
registerHelper("x-bar", function () {
return this.yield(["Xerxes", "York"]);
registerHelper('x-bar', function () {
return this.yield(['Xerxes', 'York']);
});
compilesTo("<x-bar as |x y|>{{x}},{{y}}</x-bar>", "Xerxes,York", {});
compilesTo("<x-bar as | x y|>{{x}},{{y}}</x-bar>", "Xerxes,York", {});
compilesTo("<x-bar as | x y |>{{x}},{{y}}</x-bar>", "Xerxes,York", {});
compilesTo('<x-bar as |x y|>{{x}},{{y}}</x-bar>', 'Xerxes,York', {});
compilesTo('<x-bar as | x y|>{{x}},{{y}}</x-bar>', 'Xerxes,York', {});
compilesTo('<x-bar as | x y |>{{x}},{{y}}</x-bar>', 'Xerxes,York', {});
});
test("Block params in HTML syntax - Helper should know how many block params it was called with", function () {
test('Block params in HTML syntax - Helper should know how many block params it was called with', function () {
expect(4);
registerHelper("count-block-params", function (params, hash, options) {
equal(options.template.arity, parseInt(hash.count, 10), "Helpers should receive the correct number of block params in options.template.blockParams.");
registerHelper('count-block-params', function (params, hash, options) {
equal(options.template.arity, parseInt(hash.count, 10), 'Helpers should receive the correct number of block params in options.template.blockParams.');
});
compiler.compile("<count-block-params count=\"0\"></count-block-params>").render({ count: 0 }, env, { contextualElement: document.body });
compiler.compile("<count-block-params count=\"1\" as |x|></count-block-params>").render({ count: 1 }, env, { contextualElement: document.body });
compiler.compile("<count-block-params count=\"2\" as |x y|></count-block-params>").render({ count: 2 }, env, { contextualElement: document.body });
compiler.compile("<count-block-params count=\"3\" as |x y z|></count-block-params>").render({ count: 3 }, env, { contextualElement: document.body });
compiler.compile('<count-block-params count="0"></count-block-params>').render({ count: 0 }, env, { contextualElement: document.body });
compiler.compile('<count-block-params count="1" as |x|></count-block-params>').render({ count: 1 }, env, { contextualElement: document.body });
compiler.compile('<count-block-params count="2" as |x y|></count-block-params>').render({ count: 2 }, env, { contextualElement: document.body });
compiler.compile('<count-block-params count="3" as |x y z|></count-block-params>').render({ count: 3 }, env, { contextualElement: document.body });
});

@@ -828,9 +828,9 @@

QUnit.throws(function () {
compiler.compile("<x-bar as |x y>{{x}},{{y}}</x-bar>");
compiler.compile('<x-bar as |x y>{{x}},{{y}}</x-bar>');
}, /Invalid block parameters syntax: 'as |x y'/);
QUnit.throws(function () {
compiler.compile("<x-bar as |x| y>{{x}},{{y}}</x-bar>");
compiler.compile('<x-bar as |x| y>{{x}},{{y}}</x-bar>');
}, /Invalid block parameters syntax: 'as \|x\| y'/);
QUnit.throws(function () {
compiler.compile("<x-bar as |x| y|>{{x}},{{y}}</x-bar>");
compiler.compile('<x-bar as |x| y|>{{x}},{{y}}</x-bar>');
}, /Invalid block parameters syntax: 'as \|x\| y\|'/);

@@ -843,9 +843,9 @@ });

QUnit.throws(function () {
compiler.compile("<x-bar as |x foo.bar|></x-bar>");
compiler.compile('<x-bar as |x foo.bar|></x-bar>');
}, /Invalid identifier for block parameters: 'foo\.bar' in 'as \|x foo\.bar|'/);
QUnit.throws(function () {
compiler.compile("<x-bar as |x \"foo\"|></x-bar>");
compiler.compile('<x-bar as |x "foo"|></x-bar>');
}, /Invalid identifier for block parameters: '"foo"' in 'as \|x "foo"|'/);
QUnit.throws(function () {
compiler.compile("<x-bar as |foo[bar]|></x-bar>");
compiler.compile('<x-bar as |foo[bar]|></x-bar>');
}, /Invalid identifier for block parameters: 'foo\[bar\]' in 'as \|foo\[bar\]\|'/);

@@ -862,6 +862,6 @@ });

QUnit.throws(function () {
compiler.compile("\n<div class=\"my-div\" \n foo={{bar}}>\n<span>\n</span>\n");
compiler.compile('\n<div class="my-div" \n foo={{bar}}>\n<span>\n</span>\n');
}, /Unclosed element `div` \(on line 2\)\./);
QUnit.throws(function () {
compiler.compile("\n<div class=\"my-div\">\n<span>\n");
compiler.compile('\n<div class="my-div">\n<span>\n');
}, /Unclosed element `span` \(on line 3\)\./);

@@ -897,3 +897,3 @@ });

QUnit.throws(function () {
compiler.compile("<div>\nSomething\n\n</div foo=\"bar\">");
compiler.compile('<div>\nSomething\n\n</div foo="bar">');
}, /Invalid end tag: closing tag must not have attributes, in `div` \(on line 4\)\./);

@@ -938,3 +938,3 @@ });

if (document.createElement("div").namespaceURI) {
if (document.createElement('div').namespaceURI) {

@@ -949,4 +949,4 @@ QUnit.module("HTML-based compiler (output, svg)", {

htmlbars_test_helpers.equalTokens(svgNode, "<svg xlink:title=\"svg-title\">content</svg>");
equal(svgNode.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink");
htmlbars_test_helpers.equalTokens(svgNode, '<svg xlink:title="svg-title">content</svg>');
equal(svgNode.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink');
});

@@ -956,6 +956,6 @@

var template = compiler.compile("<svg xlink:title={{title}}>content</svg>");
var svgNode = template.render({ title: "svg-title" }, env).fragment.firstChild;
var svgNode = template.render({ title: 'svg-title' }, env).fragment.firstChild;
htmlbars_test_helpers.equalTokens(svgNode, "<svg xlink:title=\"svg-title\">content</svg>");
equal(svgNode.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink");
htmlbars_test_helpers.equalTokens(svgNode, '<svg xlink:title="svg-title">content</svg>');
equal(svgNode.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink');
});

@@ -966,7 +966,7 @@

var svgNode = template.render({}, env).fragment.firstChild;
htmlbars_test_helpers.equalTokens(svgNode, "<svg viewBox=\"0 0 0 0\"></svg>");
htmlbars_test_helpers.equalTokens(svgNode, '<svg viewBox=\"0 0 0 0\"></svg>');
});
test("The compiler can handle namespaced elements", function () {
var html = "<svg><path stroke=\"black\" d=\"M 0 0 L 100 100\"></path></svg>";
var html = '<svg><path stroke="black" d="M 0 0 L 100 100"></path></svg>';
var template = compiler.compile(html);

@@ -980,3 +980,3 @@ var svgNode = template.render({}, env).fragment.firstChild;

test("The compiler sets namespaces on nested namespaced elements", function () {
var html = "<svg><path stroke=\"black\" d=\"M 0 0 L 100 100\"></path></svg>";
var html = '<svg><path stroke="black" d="M 0 0 L 100 100"></path></svg>';
var template = compiler.compile(html);

@@ -990,3 +990,3 @@ var svgNode = template.render({}, env).fragment.firstChild;

test("The compiler sets a namespace on an HTML integration point", function () {
var html = "<svg><foreignObject>Hi</foreignObject></svg>";
var html = '<svg><foreignObject>Hi</foreignObject></svg>';
var template = compiler.compile(html);

@@ -1001,3 +1001,3 @@ var svgNode = template.render({}, env).fragment.firstChild;

test("The compiler does not set a namespace on an element inside an HTML integration point", function () {
var html = "<svg><foreignObject><div></div></foreignObject></svg>";
var html = '<svg><foreignObject><div></div></foreignObject></svg>';
var template = compiler.compile(html);

@@ -1011,3 +1011,3 @@ var svgNode = template.render({}, env).fragment.firstChild;

test("The compiler pops back to the correct namespace", function () {
var html = "<svg></svg><svg></svg><div></div>";
var html = '<svg></svg><svg></svg><div></div>';
var template = compiler.compile(html);

@@ -1023,3 +1023,3 @@ var fragment = template.render({}, env).fragment;

test("The compiler pops back to the correct namespace even if exiting last child", function () {
var html = "<div><svg></svg></div><div></div>";
var html = '<div><svg></svg></div><div></div>';
var fragment = compiler.compile(html).render({}, env).fragment;

@@ -1033,3 +1033,3 @@

test("The compiler preserves capitalization of tags", function () {
var html = "<svg><linearGradient id=\"gradient\"></linearGradient></svg>";
var html = '<svg><linearGradient id="gradient"></linearGradient></svg>';
var template = compiler.compile(html);

@@ -1042,5 +1042,5 @@ var fragment = template.render({}, env).fragment;

test("svg can live with hydration", function () {
var template = compiler.compile("<svg></svg>{{name}}");
var template = compiler.compile('<svg></svg>{{name}}');
var fragment = template.render({ name: "Milly" }, env, { contextualElement: document.body }).fragment;
var fragment = template.render({ name: 'Milly' }, env, { contextualElement: document.body }).fragment;

@@ -1051,31 +1051,31 @@ equal(fragment.childNodes[0].namespaceURI, svgNamespace, "svg namespace inside a block is present");

test("top-level unsafe morph uses the correct namespace", function () {
var template = compiler.compile("<svg></svg>{{{foo}}}");
var fragment = template.render({ foo: "<span>FOO</span>" }, env, { contextualElement: document.body }).fragment;
var template = compiler.compile('<svg></svg>{{{foo}}}');
var fragment = template.render({ foo: '<span>FOO</span>' }, env, { contextualElement: document.body }).fragment;
equal(htmlbars_test_helpers.getTextContent(fragment), "FOO", "element from unsafe morph is displayed");
equal(fragment.childNodes[1].namespaceURI, xhtmlNamespace, "element from unsafe morph has correct namespace");
equal(htmlbars_test_helpers.getTextContent(fragment), 'FOO', 'element from unsafe morph is displayed');
equal(fragment.childNodes[1].namespaceURI, xhtmlNamespace, 'element from unsafe morph has correct namespace');
});
test("nested unsafe morph uses the correct namespace", function () {
var template = compiler.compile("<svg>{{{foo}}}</svg><div></div>");
var fragment = template.render({ foo: "<path></path>" }, env, { contextualElement: document.body }).fragment;
var template = compiler.compile('<svg>{{{foo}}}</svg><div></div>');
var fragment = template.render({ foo: '<path></path>' }, env, { contextualElement: document.body }).fragment;
equal(fragment.childNodes[0].childNodes[0].namespaceURI, svgNamespace, "element from unsafe morph has correct namespace");
equal(fragment.childNodes[0].childNodes[0].namespaceURI, svgNamespace, 'element from unsafe morph has correct namespace');
});
test("svg can take some hydration", function () {
var template = compiler.compile("<div><svg>{{name}}</svg></div>");
var template = compiler.compile('<div><svg>{{name}}</svg></div>');
var fragment = template.render({ name: "Milly" }, env).fragment;
var fragment = template.render({ name: 'Milly' }, env).fragment;
equal(fragment.firstChild.childNodes[0].namespaceURI, svgNamespace, "svg namespace inside a block is present");
htmlbars_test_helpers.equalTokens(fragment.firstChild, "<div><svg>Milly</svg></div>", "html is valid");
htmlbars_test_helpers.equalTokens(fragment.firstChild, '<div><svg>Milly</svg></div>', "html is valid");
});
test("root svg can take some hydration", function () {
var template = compiler.compile("<svg>{{name}}</svg>");
var fragment = template.render({ name: "Milly" }, env).fragment;
var template = compiler.compile('<svg>{{name}}</svg>');
var fragment = template.render({ name: 'Milly' }, env).fragment;
var svgNode = fragment.firstChild;
equal(svgNode.namespaceURI, svgNamespace, "svg namespace inside a block is present");
htmlbars_test_helpers.equalTokens(svgNode, "<svg>Milly</svg>", "html is valid");
htmlbars_test_helpers.equalTokens(svgNode, '<svg>Milly</svg>', "html is valid");
});

@@ -1086,3 +1086,3 @@

registerHelper("testing", function (params, hash, options) {
registerHelper('testing', function (params, hash, options) {
if (isTrue) {

@@ -1095,3 +1095,3 @@ return this.yield();

var template = compiler.compile("{{#testing}}<svg></svg>{{else}}<div><svg></svg></div>{{/testing}}");
var template = compiler.compile('{{#testing}}<svg></svg>{{else}}<div><svg></svg></div>{{/testing}}');

@@ -1108,7 +1108,7 @@ var fragment = template.render({ isTrue: true }, env, { contextualElement: document.body }).fragment;

test("Block helper allows namespace to bleed through", function () {
registerHelper("testing", function () {
registerHelper('testing', function () {
return this.yield();
});
var template = compiler.compile("<div><svg>{{#testing}}<circle />{{/testing}}</svg></div>");
var template = compiler.compile('<div><svg>{{#testing}}<circle />{{/testing}}</svg></div>');

@@ -1122,7 +1122,7 @@ var fragment = template.render({ isTrue: true }, env).fragment;

test("Block helper with root svg allows namespace to bleed through", function () {
registerHelper("testing", function () {
registerHelper('testing', function () {
return this.yield();
});
var template = compiler.compile("<svg>{{#testing}}<circle />{{/testing}}</svg>");
var template = compiler.compile('<svg>{{#testing}}<circle />{{/testing}}</svg>');

@@ -1136,9 +1136,9 @@ var fragment = template.render({ isTrue: true }, env).fragment;

test("Block helper with root foreignObject allows namespace to bleed through", function () {
registerHelper("testing", function () {
registerHelper('testing', function () {
return this.yield();
});
var template = compiler.compile("<foreignObject>{{#testing}}<div></div>{{/testing}}</foreignObject>");
var template = compiler.compile('<foreignObject>{{#testing}}<div></div>{{/testing}}</foreignObject>');
var fragment = template.render({ isTrue: true }, env, { contextualElement: document.createElementNS(svgNamespace, "svg") }).fragment;
var fragment = template.render({ isTrue: true }, env, { contextualElement: document.createElementNS(svgNamespace, 'svg') }).fragment;
var svgNode = fragment.firstChild;

@@ -1145,0 +1145,0 @@ equal(svgNode.namespaceURI, svgNamespace, "foreignObject tag has an svg namespace");

@@ -17,15 +17,15 @@ 'use strict';

function loc(startCol, endCol) {
var startLine = arguments[2] === undefined ? 1 : arguments[2];
var endLine = arguments[3] === undefined ? 1 : arguments[3];
var source = arguments[4] === undefined ? null : arguments[4];
var startLine = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
var endLine = arguments.length <= 3 || arguments[3] === undefined ? 1 : arguments[3];
var source = arguments.length <= 4 || arguments[4] === undefined ? null : arguments[4];
return ["loc", [source, [startLine, startCol], [endLine, endCol]]];
return ['loc', [source, [startLine, startCol], [endLine, endCol]]];
}
function sloc(startCol, endCol) {
var startLine = arguments[2] === undefined ? 1 : arguments[2];
var endLine = arguments[3] === undefined ? 1 : arguments[3];
var source = arguments[4] === undefined ? null : arguments[4];
var startLine = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
var endLine = arguments.length <= 3 || arguments[3] === undefined ? 1 : arguments[3];
var source = arguments.length <= 4 || arguments[4] === undefined ? null : arguments[4];
return ["loc", [source, [startLine, startCol], [endLine, endCol]]];
return ['loc', [source, [startLine, startCol], [endLine, endCol]]];
}

@@ -104,43 +104,43 @@

content: function (path, loc) {
return ["content", path, sloc.apply(undefined, loc)];
return ['content', path, sloc.apply(undefined, loc)];
},
block: function (name, loc) {
var template = arguments[2] === undefined ? null : arguments[2];
var params = arguments[3] === undefined ? [] : arguments[3];
var hash = arguments[4] === undefined ? [] : arguments[4];
var inverse = arguments[5] === undefined ? null : arguments[5];
var template = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var params = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3];
var hash = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
var inverse = arguments.length <= 5 || arguments[5] === undefined ? null : arguments[5];
return ["block", name, params, hash, template, inverse, sloc.apply(undefined, loc)];
return ['block', name, params, hash, template, inverse, sloc.apply(undefined, loc)];
},
inline: function (name) {
var params = arguments[1] === undefined ? [] : arguments[1];
var hash = arguments[2] === undefined ? [] : arguments[2];
var loc = arguments[3] === undefined ? null : arguments[3];
var params = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var hash = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
var loc = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
return ["inline", name, params, hash, sloc.apply(undefined, loc)];
return ['inline', name, params, hash, sloc.apply(undefined, loc)];
},
element: function (name) {
var params = arguments[1] === undefined ? [] : arguments[1];
var hash = arguments[2] === undefined ? [] : arguments[2];
var loc = arguments[3] === undefined ? null : arguments[3];
var params = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var hash = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
var loc = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
return ["element", name, params, hash, sloc.apply(undefined, loc)];
return ['element', name, params, hash, sloc.apply(undefined, loc)];
},
attribute: function (name, expression) {
return ["attribute", name, expression];
return ['attribute', name, expression];
},
component: function (path) {
var attrs = arguments[1] === undefined ? [] : arguments[1];
var template = arguments[2] === undefined ? null : arguments[2];
var attrs = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var template = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
return ["component", path, attrs, template];
return ['component', path, attrs, template];
},
get: function (path, loc) {
return ["get", path, sloc.apply(undefined, loc)];
return ['get', path, sloc.apply(undefined, loc)];
},

@@ -153,50 +153,50 @@

return ["concat", args];
return ['concat', args];
},
subexpr: function (name) {
var params = arguments[1] === undefined ? [] : arguments[1];
var hash = arguments[2] === undefined ? [] : arguments[2];
var loc = arguments[3] === undefined ? null : arguments[3];
var params = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
var hash = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
var loc = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
return ["subexpr", name, params, hash, sloc.apply(undefined, loc)];
return ['subexpr', name, params, hash, sloc.apply(undefined, loc)];
}
};
testCompile("simple example", "<div>{{foo}} bar {{baz}}</div>", [["consumeParent", [0]], ["shareElement", [0]], ["createMorph", [0, [0], 0, 0, true]], ["createMorph", [1, [0], 2, 2, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["pushLiteral", ["baz"]], ["printContentHook", [loc(17, 24)]], ["popParent", []]], [s.content("foo", [5, 12]), s.content("baz", [17, 24])]);
testCompile("simple example", "<div>{{foo}} bar {{baz}}</div>", [["consumeParent", [0]], ["shareElement", [0]], ["createMorph", [0, [0], 0, 0, true]], ["createMorph", [1, [0], 2, 2, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["pushLiteral", ["baz"]], ["printContentHook", [loc(17, 24)]], ["popParent", []]], [s.content('foo', [5, 12]), s.content('baz', [17, 24])]);
testCompile("simple block", "<div>{{#foo}}{{/foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["printBlockHook", [0, null, loc(5, 21)]], ["popParent", []]], [s.block("foo", [5, 21], 0)], []);
testCompile("simple block", "<div>{{#foo}}{{/foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["printBlockHook", [0, null, loc(5, 21)]], ["popParent", []]], [s.block('foo', [5, 21], 0)], []);
testCompile("simple block with block params", "<div>{{#foo as |bar baz|}}{{/foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["printBlockHook", [0, null, loc(5, 34)]], ["popParent", []]], [s.block("foo", [5, 34], 0)], []);
testCompile("simple block with block params", "<div>{{#foo as |bar baz|}}{{/foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["printBlockHook", [0, null, loc(5, 34)]], ["popParent", []]], [s.block('foo', [5, 34], 0)], []);
testCompile("element with a sole mustache child", "<div>{{foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["popParent", []]], [s.content("foo", [5, 12])]);
testCompile("element with a sole mustache child", "<div>{{foo}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["popParent", []]], [s.content('foo', [5, 12])]);
testCompile("element with a mustache between two text nodes", "<div> {{foo}} </div>", [["consumeParent", [0]], ["createMorph", [0, [0], 1, 1, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(6, 13)]], ["popParent", []]], [s.content("foo", [6, 13])]);
testCompile("element with a mustache between two text nodes", "<div> {{foo}} </div>", [["consumeParent", [0]], ["createMorph", [0, [0], 1, 1, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(6, 13)]], ["popParent", []]], [s.content('foo', [6, 13])]);
testCompile("mustache two elements deep", "<div><div>{{foo}}</div></div>", [["consumeParent", [0]], ["consumeParent", [0]], ["createMorph", [0, [0, 0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(10, 17)]], ["popParent", []], ["popParent", []]], [s.content("foo", [10, 17])]);
testCompile("mustache two elements deep", "<div><div>{{foo}}</div></div>", [["consumeParent", [0]], ["consumeParent", [0]], ["createMorph", [0, [0, 0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(10, 17)]], ["popParent", []], ["popParent", []]], [s.content('foo', [10, 17])]);
testCompile("two sibling elements with mustaches", "<div>{{foo}}</div><div>{{bar}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["popParent", []], ["consumeParent", [1]], ["createMorph", [1, [1], 0, 0, true]], ["pushLiteral", ["bar"]], ["printContentHook", [loc(23, 30)]], ["popParent", []]], [s.content("foo", [5, 12]), s.content("bar", [23, 30])]);
testCompile("two sibling elements with mustaches", "<div>{{foo}}</div><div>{{bar}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["popParent", []], ["consumeParent", [1]], ["createMorph", [1, [1], 0, 0, true]], ["pushLiteral", ["bar"]], ["printContentHook", [loc(23, 30)]], ["popParent", []]], [s.content('foo', [5, 12]), s.content('bar', [23, 30])]);
testCompile("mustaches at the root", "{{foo}} {{bar}}", [["createMorph", [0, [], 0, 0, true]], ["createMorph", [1, [], 2, 2, true]], ["openBoundary", []], ["pushLiteral", ["foo"]], ["printContentHook", [loc(0, 7)]], ["closeBoundary", []], ["pushLiteral", ["bar"]], ["printContentHook", [loc(8, 15)]]], [s.content("foo", [0, 7]), s.content("bar", [8, 15])]);
testCompile("mustaches at the root", "{{foo}} {{bar}}", [["createMorph", [0, [], 0, 0, true]], ["createMorph", [1, [], 2, 2, true]], ["openBoundary", []], ["pushLiteral", ["foo"]], ["printContentHook", [loc(0, 7)]], ["closeBoundary", []], ["pushLiteral", ["bar"]], ["printContentHook", [loc(8, 15)]]], [s.content('foo', [0, 7]), s.content('bar', [8, 15])]);
testCompile("back to back mustaches should have a text node inserted between them", "<div>{{foo}}{{bar}}{{baz}}wat{{qux}}</div>", [["consumeParent", [0]], ["shareElement", [0]], ["createMorph", [0, [0], 0, 0, true]], ["createMorph", [1, [0], 1, 1, true]], ["createMorph", [2, [0], 2, 2, true]], ["createMorph", [3, [0], 4, 4, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["pushLiteral", ["bar"]], ["printContentHook", [loc(12, 19)]], ["pushLiteral", ["baz"]], ["printContentHook", [loc(19, 26)]], ["pushLiteral", ["qux"]], ["printContentHook", [loc(29, 36)]], ["popParent", []]], [s.content("foo", [5, 12]), s.content("bar", [12, 19]), s.content("baz", [19, 26]), s.content("qux", [29, 36])]);
testCompile("back to back mustaches should have a text node inserted between them", "<div>{{foo}}{{bar}}{{baz}}wat{{qux}}</div>", [["consumeParent", [0]], ["shareElement", [0]], ["createMorph", [0, [0], 0, 0, true]], ["createMorph", [1, [0], 1, 1, true]], ["createMorph", [2, [0], 2, 2, true]], ["createMorph", [3, [0], 4, 4, true]], ["pushLiteral", ["foo"]], ["printContentHook", [loc(5, 12)]], ["pushLiteral", ["bar"]], ["printContentHook", [loc(12, 19)]], ["pushLiteral", ["baz"]], ["printContentHook", [loc(19, 26)]], ["pushLiteral", ["qux"]], ["printContentHook", [loc(29, 36)]], ["popParent", []]], [s.content('foo', [5, 12]), s.content('bar', [12, 19]), s.content('baz', [19, 26]), s.content('qux', [29, 36])]);
testCompile("helper usage", "<div>{{foo 'bar' baz.bat true 3.14}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["pushLiteral", [3.14]], ["pushLiteral", [true]], ["pushGetHook", ["baz.bat", loc(17, 24)]], ["pushLiteral", ["bar"]], ["prepareArray", [4]], ["pushLiteral", ["foo"]], ["printInlineHook", [loc(5, 36)]], ["popParent", []]], [s.inline("foo", ["bar", s.get("baz.bat", [17, 24]), true, 3.14], [], [5, 36])]);
testCompile("helper usage", "<div>{{foo 'bar' baz.bat true 3.14}}</div>", [["consumeParent", [0]], ["createMorph", [0, [0], 0, 0, true]], ["prepareObject", [0]], ["pushLiteral", [3.14]], ["pushLiteral", [true]], ["pushGetHook", ["baz.bat", loc(17, 24)]], ["pushLiteral", ["bar"]], ["prepareArray", [4]], ["pushLiteral", ["foo"]], ["printInlineHook", [loc(5, 36)]], ["popParent", []]], [s.inline('foo', ['bar', s.get('baz.bat', [17, 24]), true, 3.14], [], [5, 36])]);
testCompile("node mustache", "<div {{foo}}></div>", [["consumeParent", [0]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["shareElement", [0]], ["createElementMorph", [0, 0]], ["printElementHook", [loc(5, 12)]], ["popParent", []]], [s.element("foo", [], [], [5, 12])]);
testCompile("node mustache", "<div {{foo}}></div>", [["consumeParent", [0]], ["prepareObject", [0]], ["prepareArray", [0]], ["pushLiteral", ["foo"]], ["shareElement", [0]], ["createElementMorph", [0, 0]], ["printElementHook", [loc(5, 12)]], ["popParent", []]], [s.element('foo', [], [], [5, 12])]);
testCompile("node helper", "<div {{foo 'bar'}}></div>", [["consumeParent", [0]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["shareElement", [0]], ["createElementMorph", [0, 0]], ["printElementHook", [loc(5, 18)]], ["popParent", []]], [s.element("foo", ["bar"], [], [5, 18])]);
testCompile("node helper", "<div {{foo 'bar'}}></div>", [["consumeParent", [0]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["shareElement", [0]], ["createElementMorph", [0, 0]], ["printElementHook", [loc(5, 18)]], ["popParent", []]], [s.element('foo', ['bar'], [], [5, 18])]);
testCompile("attribute mustache", "<div class='before {{foo}} after'></div>", [["consumeParent", [0]], ["pushLiteral", [" after"]], ["pushGetHook", ["foo", loc(21, 24)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.concat("before ", s.get("foo", [21, 24]), " after"))]);
testCompile("attribute mustache", "<div class='before {{foo}} after'></div>", [["consumeParent", [0]], ["pushLiteral", [" after"]], ["pushGetHook", ["foo", loc(21, 24)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.concat('before ', s.get('foo', [21, 24]), ' after'))]);
testCompile("quoted attribute mustache", "<div class='{{foo}}'></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(14, 17)]], ["prepareArray", [1]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.concat(s.get("foo", [14, 17])))]);
testCompile("quoted attribute mustache", "<div class='{{foo}}'></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(14, 17)]], ["prepareArray", [1]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.concat(s.get('foo', [14, 17])))]);
testCompile("safe bare attribute mustache", "<div class={{foo}}></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(13, 16)]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.get("foo", [13, 16]))]);
testCompile("safe bare attribute mustache", "<div class={{foo}}></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(13, 16)]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.get('foo', [13, 16]))]);
testCompile("unsafe bare attribute mustache", "<div class={{{foo}}}></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(14, 17)]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", false, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.get("foo", [14, 17]))]);
testCompile("unsafe bare attribute mustache", "<div class={{{foo}}}></div>", [["consumeParent", [0]], ["pushGetHook", ["foo", loc(14, 17)]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", false, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.get('foo', [14, 17]))]);
testCompile("attribute helper", "<div class='before {{foo 'bar'}} after'></div>", [["consumeParent", [0]], ["pushLiteral", [" after"]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["pushSexprHook", [loc(19, 32)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.concat("before ", s.subexpr("foo", ["bar"], [], [19, 32]), " after"))]);
testCompile("attribute helper", "<div class='before {{foo 'bar'}} after'></div>", [["consumeParent", [0]], ["pushLiteral", [" after"]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["pushSexprHook", [loc(19, 32)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["shareElement", [0]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.concat('before ', s.subexpr('foo', ['bar'], [], [19, 32]), ' after'))]);
testCompile("attribute helpers", "<div class='before {{foo 'bar'}} after' id={{bare}}></div>{{morphThing}}<span class='{{ohMy}}'></span>", [["consumeParent", [0]], ["shareElement", [0]], ["pushLiteral", [" after"]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["pushSexprHook", [loc(19, 32)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["pushGetHook", ["bare", loc(45, 49)]], ["pushLiteral", ["id"]], ["createAttrMorph", [1, 0, "id", true, null]], ["printAttributeHook", []], ["popParent", []], ["createMorph", [2, [], 1, 1, true]], ["pushLiteral", ["morphThing"]], ["printContentHook", [loc(58, 72)]], ["consumeParent", [2]], ["pushGetHook", ["ohMy", loc(87, 91)]], ["prepareArray", [1]], ["pushConcatHook", [3]], ["pushLiteral", ["class"]], ["shareElement", [1]], ["createAttrMorph", [3, 1, "class", true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute("class", s.concat("before ", s.subexpr("foo", ["bar"], [], [19, 32]), " after")), s.attribute("id", s.get("bare", [45, 49])), s.content("morphThing", [58, 72]), s.attribute("class", s.concat(s.get("ohMy", [87, 91])))]);
testCompile("attribute helpers", "<div class='before {{foo 'bar'}} after' id={{bare}}></div>{{morphThing}}<span class='{{ohMy}}'></span>", [["consumeParent", [0]], ["shareElement", [0]], ["pushLiteral", [" after"]], ["prepareObject", [0]], ["pushLiteral", ["bar"]], ["prepareArray", [1]], ["pushLiteral", ["foo"]], ["pushSexprHook", [loc(19, 32)]], ["pushLiteral", ["before "]], ["prepareArray", [3]], ["pushConcatHook", [0]], ["pushLiteral", ["class"]], ["createAttrMorph", [0, 0, "class", true, null]], ["printAttributeHook", []], ["pushGetHook", ['bare', loc(45, 49)]], ["pushLiteral", ['id']], ["createAttrMorph", [1, 0, 'id', true, null]], ["printAttributeHook", []], ["popParent", []], ["createMorph", [2, [], 1, 1, true]], ["pushLiteral", ['morphThing']], ["printContentHook", [loc(58, 72)]], ["consumeParent", [2]], ["pushGetHook", ['ohMy', loc(87, 91)]], ["prepareArray", [1]], ["pushConcatHook", [3]], ["pushLiteral", ['class']], ["shareElement", [1]], ["createAttrMorph", [3, 1, 'class', true, null]], ["printAttributeHook", []], ["popParent", []]], [s.attribute('class', s.concat('before ', s.subexpr('foo', ['bar'], [], [19, 32]), ' after')), s.attribute('id', s.get('bare', [45, 49])), s.content('morphThing', [58, 72]), s.attribute('class', s.concat(s.get('ohMy', [87, 91])))]);
testCompile("component helpers", "<my-component>hello</my-component>", [["createMorph", [0, [], 0, 0, true]], ["openBoundary", []], ["closeBoundary", []], ["prepareObject", [0]], ["pushLiteral", ["my-component"]], ["printComponentHook", [0, 0, loc(0, 34)]]], [s.component("my-component", [], 0)], []);
testCompile('component helpers', "<my-component>hello</my-component>", [["createMorph", [0, [], 0, 0, true]], ["openBoundary", []], ["closeBoundary", []], ["prepareObject", [0]], ["pushLiteral", ["my-component"]], ["printComponentHook", [0, 0, loc(0, 34)]]], [s.component('my-component', [], 0)], []);

@@ -17,7 +17,7 @@ 'use strict';

test("it omits unnecessary namespace changes", function () {
equal(countNamespaceChanges("<div></div>"), 0); // sanity check
equal(countNamespaceChanges("<div><svg></svg></div><svg></svg>"), 1);
equal(countNamespaceChanges("<div><svg></svg></div><div></div>"), 2);
equal(countNamespaceChanges("<div><svg><title>foobar</title></svg></div><svg></svg>"), 1);
equal(countNamespaceChanges("<div><svg><title><h1>foobar</h1></title></svg></div><svg></svg>"), 3);
equal(countNamespaceChanges('<div></div>'), 0); // sanity check
equal(countNamespaceChanges('<div><svg></svg></div><svg></svg>'), 1);
equal(countNamespaceChanges('<div><svg></svg></div><div></div>'), 2);
equal(countNamespaceChanges('<div><svg><title>foobar</title></svg></div><svg></svg>'), 1);
equal(countNamespaceChanges('<div><svg><title><h1>foobar</h1></title></svg></div><svg></svg>'), 3);
});

@@ -25,3 +25,3 @@ 'use strict';

var input = "";
actionsEqual(input, [["startProgram", [0, []]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['endProgram', [0]]]);
});

@@ -31,3 +31,3 @@

var input = "foo{{bar}}<div></div>";
actionsEqual(input, [["startProgram", [0, []]], ["text", [0, 3]], ["mustache", [1, 3]], ["openElement", [2, 3, 0, []]], ["closeElement", [2, 3]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['text', [0, 3]], ['mustache', [1, 3]], ['openElement', [2, 3, 0, []]], ['closeElement', [2, 3]], ['endProgram', [0]]]);
});

@@ -37,3 +37,3 @@

var input = "<a></a><a><a><a></a></a></a>";
actionsEqual(input, [["startProgram", [0, []]], ["openElement", [0, 2, 0, []]], ["closeElement", [0, 2]], ["openElement", [1, 2, 0, []]], ["openElement", [0, 1, 0, []]], ["openElement", [0, 1, 0, []]], ["closeElement", [0, 1]], ["closeElement", [0, 1]], ["closeElement", [1, 2]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['openElement', [0, 2, 0, []]], ['closeElement', [0, 2]], ['openElement', [1, 2, 0, []]], ['openElement', [0, 1, 0, []]], ['openElement', [0, 1, 0, []]], ['closeElement', [0, 1]], ['closeElement', [0, 1]], ['closeElement', [1, 2]], ['endProgram', [0]]]);
});

@@ -43,3 +43,3 @@

var input = "<a><a>{{foo}}</a><a {{foo}}><a>{{foo}}</a><a>{{foo}}</a></a></a>";
actionsEqual(input, [["startProgram", [0, []]], ["openElement", [0, 1, 2, []]], ["openElement", [0, 2, 1, []]], ["mustache", [0, 1]], ["closeElement", [0, 2]], ["openElement", [1, 2, 3, []]], ["openElement", [0, 2, 1, []]], ["mustache", [0, 1]], ["closeElement", [0, 2]], ["openElement", [1, 2, 1, []]], ["mustache", [0, 1]], ["closeElement", [1, 2]], ["closeElement", [1, 2]], ["closeElement", [0, 1]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['openElement', [0, 1, 2, []]], ['openElement', [0, 2, 1, []]], ['mustache', [0, 1]], ['closeElement', [0, 2]], ['openElement', [1, 2, 3, []]], ['openElement', [0, 2, 1, []]], ['mustache', [0, 1]], ['closeElement', [0, 2]], ['openElement', [1, 2, 1, []]], ['mustache', [0, 1]], ['closeElement', [1, 2]], ['closeElement', [1, 2]], ['closeElement', [0, 1]], ['endProgram', [0]]]);
});

@@ -49,3 +49,3 @@

var input = "{{#a}}{{/a}}";
actionsEqual(input, [["startProgram", [0, []]], ["endProgram", [1]], ["startProgram", [1, []]], ["block", [0, 1]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['endProgram', [1]], ['startProgram', [1, []]], ['block', [0, 1]], ['endProgram', [0]]]);
});

@@ -55,3 +55,3 @@

var input = "{{#a}}b{{^}}{{/a}}";
actionsEqual(input, [["startProgram", [0, []]], ["endProgram", [1]], ["startProgram", [0, []]], ["text", [0, 1]], ["endProgram", [1]], ["startProgram", [2, []]], ["block", [0, 1]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['endProgram', [1]], ['startProgram', [0, []]], ['text', [0, 1]], ['endProgram', [1]], ['startProgram', [2, []]], ['block', [0, 1]], ['endProgram', [0]]]);
});

@@ -61,3 +61,3 @@

var input = "{{#a}}{{#a}}<b></b>{{/a}}{{#a}}{{b}}{{/a}}{{/a}}{{#a}}b{{/a}}";
actionsEqual(input, [["startProgram", [0, []]], ["text", [0, 1]], ["endProgram", [1]], ["startProgram", [0, []]], ["mustache", [0, 1]], ["endProgram", [2]], ["startProgram", [0, []]], ["openElement", [0, 1, 0, []]], ["closeElement", [0, 1]], ["endProgram", [2]], ["startProgram", [2, []]], ["block", [0, 2]], ["block", [1, 2]], ["endProgram", [1]], ["startProgram", [2, []]], ["block", [0, 2]], ["block", [1, 2]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['text', [0, 1]], ['endProgram', [1]], ['startProgram', [0, []]], ['mustache', [0, 1]], ['endProgram', [2]], ['startProgram', [0, []]], ['openElement', [0, 1, 0, []]], ['closeElement', [0, 1]], ['endProgram', [2]], ['startProgram', [2, []]], ['block', [0, 2]], ['block', [1, 2]], ['endProgram', [1]], ['startProgram', [2, []]], ['block', [0, 2]], ['block', [1, 2]], ['endProgram', [0]]]);
});

@@ -67,3 +67,3 @@

var input = "<x-foo>bar</x-foo>";
actionsEqual(input, [["startProgram", [0, []]], ["text", [0, 1]], ["endProgram", [1]], ["startProgram", [1, []]], ["component", [0, 1]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['text', [0, 1]], ['endProgram', [1]], ['startProgram', [1, []]], ['component', [0, 1]], ['endProgram', [0]]]);
});

@@ -73,3 +73,3 @@

var input = "<!-- some comment -->";
actionsEqual(input, [["startProgram", [0, []]], ["comment", [0, 1]], ["endProgram", [0]]]);
actionsEqual(input, [['startProgram', [0, []]], ['comment', [0, 1]], ['endProgram', [0]]]);
});

@@ -12,3 +12,2 @@ 'use strict';

function compileSpec(string, options) {

@@ -26,2 +25,3 @@ var ast = parser.preprocess(string, options);

*/
function template(templateSpec) {

@@ -62,4 +62,5 @@ return new Function("return " + templateSpec)();

*/
function compile(string, options) {
return hooks.wrap(template(compileSpec(string, options)), render['default']);
}

@@ -9,3 +9,3 @@ 'use strict';

// http://www.w3.org/html/wg/drafts/html/master/syntax.html#html-integration-point
svgHTMLIntegrationPoints = { "foreignObject": true, "desc": true, "title": true };
svgHTMLIntegrationPoints = { 'foreignObject': true, 'desc': true, 'title': true };

@@ -26,21 +26,21 @@ function FragmentJavaScriptCompiler() {

this.source.push("function buildFragment(dom) {\n");
this.source.push('function buildFragment(dom) {\n');
utils.processOpcodes(this, opcodes);
this.source.push(this.indent + "}");
this.source.push(this.indent + '}');
return this.source.join("");
return this.source.join('');
};
FragmentJavaScriptCompiler.prototype.createFragment = function () {
var el = "el" + ++this.depth;
this.source.push(this.indent + " var " + el + " = dom.createDocumentFragment();\n");
var el = 'el' + ++this.depth;
this.source.push(this.indent + ' var ' + el + ' = dom.createDocumentFragment();\n');
};
FragmentJavaScriptCompiler.prototype.createElement = function (tagName) {
var el = "el" + ++this.depth;
if (tagName === "svg") {
var el = 'el' + ++this.depth;
if (tagName === 'svg') {
this.pushNamespaceFrame({ namespace: svgNamespace, depth: this.depth });
}
this.ensureNamespace();
this.source.push(this.indent + " var " + el + " = dom.createElement(" + quoting.string(tagName) + ");\n");
this.source.push(this.indent + ' var ' + el + ' = dom.createElement(' + quoting.string(tagName) + ');\n');
if (svgHTMLIntegrationPoints[tagName]) {

@@ -52,22 +52,22 @@ this.pushNamespaceFrame({ namespace: null, depth: this.depth });

FragmentJavaScriptCompiler.prototype.createText = function (str) {
var el = "el" + ++this.depth;
this.source.push(this.indent + " var " + el + " = dom.createTextNode(" + quoting.string(str) + ");\n");
var el = 'el' + ++this.depth;
this.source.push(this.indent + ' var ' + el + ' = dom.createTextNode(' + quoting.string(str) + ');\n');
};
FragmentJavaScriptCompiler.prototype.createComment = function (str) {
var el = "el" + ++this.depth;
this.source.push(this.indent + " var " + el + " = dom.createComment(" + quoting.string(str) + ");\n");
var el = 'el' + ++this.depth;
this.source.push(this.indent + ' var ' + el + ' = dom.createComment(' + quoting.string(str) + ');\n');
};
FragmentJavaScriptCompiler.prototype.returnNode = function () {
var el = "el" + this.depth;
this.source.push(this.indent + " return " + el + ";\n");
var el = 'el' + this.depth;
this.source.push(this.indent + ' return ' + el + ';\n');
};
FragmentJavaScriptCompiler.prototype.setAttribute = function (name, value, namespace) {
var el = "el" + this.depth;
var el = 'el' + this.depth;
if (namespace) {
this.source.push(this.indent + " dom.setAttributeNS(" + el + "," + quoting.string(namespace) + "," + quoting.string(name) + "," + quoting.string(value) + ");\n");
this.source.push(this.indent + ' dom.setAttributeNS(' + el + ',' + quoting.string(namespace) + ',' + quoting.string(name) + ',' + quoting.string(value) + ');\n');
} else {
this.source.push(this.indent + " dom.setAttribute(" + el + "," + quoting.string(name) + "," + quoting.string(value) + ");\n");
this.source.push(this.indent + ' dom.setAttribute(' + el + ',' + quoting.string(name) + ',' + quoting.string(value) + ');\n');
}

@@ -80,5 +80,5 @@ };

}
var child = "el" + this.depth--;
var el = "el" + this.depth;
this.source.push(this.indent + " dom.appendChild(" + el + ", " + child + ");\n");
var child = 'el' + this.depth--;
var el = 'el' + this.depth;
this.source.push(this.indent + ' dom.appendChild(' + el + ', ' + child + ');\n');
};

@@ -101,5 +101,5 @@

if (this.domNamespace !== correctNamespace) {
this.source.push(this.indent + " dom.setNamespace(" + (correctNamespace ? quoting.string(correctNamespace) : "null") + ");\n");
this.source.push(this.indent + ' dom.setNamespace(' + (correctNamespace ? quoting.string(correctNamespace) : 'null') + ');\n');
this.domNamespace = correctNamespace;
}
};

@@ -28,13 +28,13 @@ 'use strict';

FragmentOpcodeCompiler.prototype.text = function (text) {
this.opcode("createText", [text.chars]);
this.opcode("appendChild");
this.opcode('createText', [text.chars]);
this.opcode('appendChild');
};
FragmentOpcodeCompiler.prototype.comment = function (comment) {
this.opcode("createComment", [comment.value]);
this.opcode("appendChild");
this.opcode('createComment', [comment.value]);
this.opcode('appendChild');
};
FragmentOpcodeCompiler.prototype.openElement = function (element) {
this.opcode("createElement", [element.tag]);
this.opcode('createElement', [element.tag]);
array_utils.forEach(element.attributes, this.attribute, this);

@@ -44,3 +44,3 @@ };

FragmentOpcodeCompiler.prototype.closeElement = function () {
this.opcode("appendChild");
this.opcode('appendChild');
};

@@ -50,7 +50,7 @@

this.opcodes.length = 0;
this.opcode("createFragment");
this.opcode('createFragment');
};
FragmentOpcodeCompiler.prototype.endProgram = function () {
this.opcode("returnNode");
this.opcode('returnNode');
};

@@ -71,10 +71,10 @@

FragmentOpcodeCompiler.prototype.pushMorphPlaceholderNode = function () {
this.opcode("createComment", [""]);
this.opcode("appendChild");
this.opcode('createComment', [""]);
this.opcode('appendChild');
};
FragmentOpcodeCompiler.prototype.attribute = function (attr) {
if (attr.value.type === "TextNode") {
if (attr.value.type === 'TextNode') {
var namespace = htmlbars_util.getAttrNamespace(attr.name);
this.opcode("setAttribute", [attr.name, attr.value.chars, namespace]);
this.opcode('setAttribute', [attr.name, attr.value.chars, namespace]);
}

@@ -84,3 +84,3 @@ };

FragmentOpcodeCompiler.prototype.setNamespace = function (namespace) {
this.opcode("setNamespace", [namespace]);
this.opcode('setNamespace', [namespace]);
};

@@ -10,3 +10,3 @@ 'use strict';

this.mustaches = [];
this.parents = [["fragment"]];
this.parents = [['fragment']];
this.parentCount = 0;

@@ -27,3 +27,3 @@ this.morphs = [];

this.parents.length = 1;
this.parents[0] = ["fragment"];
this.parents[0] = ['fragment'];
this.morphs.length = 0;

@@ -59,5 +59,5 @@ this.fragmentProcessing.length = 0;

var result = {
createMorphsProgram: "",
hydrateMorphsProgram: "",
fragmentProcessingProgram: "",
createMorphsProgram: '',
hydrateMorphsProgram: '',
fragmentProcessingProgram: '',
statements: this.statements,

@@ -68,11 +68,11 @@ locals: this.locals,

result.hydrateMorphsProgram = this.source.join("");
result.hydrateMorphsProgram = this.source.join('');
if (this.morphs.length) {
result.hasMorphs = true;
morphs = indent + " var morphs = new Array(" + this.morphs.length + ");\n";
morphs = indent + ' var morphs = new Array(' + this.morphs.length + ');\n';
for (i = 0, l = this.morphs.length; i < l; ++i) {
var morph = this.morphs[i];
morphs += indent + " morphs[" + i + "] = " + morph + ";\n";
morphs += indent + ' morphs[' + i + '] = ' + morph + ';\n';
}

@@ -84,3 +84,3 @@ }

for (i = 0, l = this.fragmentProcessing.length; i < l; ++i) {
processing += this.indent + " " + this.fragmentProcessing[i] + "\n";
processing += this.indent + ' ' + this.fragmentProcessing[i] + '\n';
}

@@ -92,3 +92,3 @@ result.fragmentProcessingProgram = processing;

if (result.hasMorphs) {
createMorphsProgram = "function buildRenderNodes(dom, fragment, contextualElement) {\n" + result.fragmentProcessingProgram + morphs;
createMorphsProgram = 'function buildRenderNodes(dom, fragment, contextualElement) {\n' + result.fragmentProcessingProgram + morphs;

@@ -103,5 +103,5 @@ if (this.hasOpenBoundary) {

createMorphsProgram += indent + " return morphs;\n" + indent + "}";
createMorphsProgram += indent + ' return morphs;\n' + indent + '}';
} else {
createMorphsProgram = "function buildRenderNodes() { return []; }";
createMorphsProgram = 'function buildRenderNodes() { return []; }';
}

@@ -147,11 +147,11 @@

prototype.pushGetHook = function (path, meta) {
this.expressionStack.push(["get", path, meta]);
this.expressionStack.push(['get', path, meta]);
};
prototype.pushSexprHook = function (meta) {
this.expressionStack.push(["subexpr", this.expressionStack.pop(), this.expressionStack.pop(), this.expressionStack.pop(), meta]);
this.expressionStack.push(['subexpr', this.expressionStack.pop(), this.expressionStack.pop(), this.expressionStack.pop(), meta]);
};
prototype.pushConcatHook = function () {
this.expressionStack.push(["concat", this.expressionStack.pop()]);
this.expressionStack.push(['concat', this.expressionStack.pop()]);
};

@@ -164,3 +164,3 @@

prototype.printBlockHook = function (templateId, inverseId, meta) {
this.statements.push(["block", this.expressionStack.pop(), // path
this.statements.push(['block', this.expressionStack.pop(), // path
this.expressionStack.pop(), // params

@@ -176,11 +176,11 @@ this.expressionStack.pop(), // hash

this.statements.push(["inline", path, params, hash, meta]);
this.statements.push(['inline', path, params, hash, meta]);
};
prototype.printContentHook = function (meta) {
this.statements.push(["content", this.expressionStack.pop(), meta]);
this.statements.push(['content', this.expressionStack.pop(), meta]);
};
prototype.printComponentHook = function (templateId) {
this.statements.push(["component", this.expressionStack.pop(), // path
this.statements.push(['component', this.expressionStack.pop(), // path
this.expressionStack.pop(), // attrs

@@ -191,3 +191,3 @@ templateId]);

prototype.printAttributeHook = function () {
this.statements.push(["attribute", this.expressionStack.pop(), // name
this.statements.push(['attribute', this.expressionStack.pop(), // name
this.expressionStack.pop() // value;

@@ -198,3 +198,3 @@ ]);

prototype.printElementHook = function (meta) {
this.statements.push(["element", this.expressionStack.pop(), // path
this.statements.push(['element', this.expressionStack.pop(), // path
this.expressionStack.pop(), // params

@@ -209,3 +209,3 @@ this.expressionStack.pop(), // hash

var morphMethod = escaped ? "createMorphAt" : "createUnsafeMorphAt";
var morphMethod = escaped ? 'createMorphAt' : 'createUnsafeMorphAt';
var morph = "dom." + morphMethod + "(" + parent + "," + (startIndex === null ? "-1" : startIndex) + "," + (endIndex === null ? "-1" : endIndex) + (isRoot ? ",contextualElement)" : ")");

@@ -217,4 +217,4 @@

prototype.createAttrMorph = function (attrMorphNum, elementNum, name, escaped, namespace) {
var morphMethod = escaped ? "createAttrMorph" : "createUnsafeAttrMorph";
var morph = "dom." + morphMethod + "(element" + elementNum + ", '" + name + (namespace ? "', '" + namespace : "") + "')";
var morphMethod = escaped ? 'createAttrMorph' : 'createUnsafeAttrMorph';
var morph = "dom." + morphMethod + "(element" + elementNum + ", '" + name + (namespace ? "', '" + namespace : '') + "')";
this.morphs[attrMorphNum] = morph;

@@ -224,3 +224,3 @@ };

prototype.createElementMorph = function (morphNum, elementNum) {
var morphMethod = "createElementMorph";
var morphMethod = 'createElementMorph';
var morph = "dom." + morphMethod + "(element" + elementNum + ")";

@@ -232,3 +232,3 @@ this.morphs[morphNum] = morph;

var parent = this.getParent(),
processing = "if (this.cachedFragment) { dom.repairClonedNode(" + parent + "," + quoting.array(blankChildTextNodes) + (isElementChecked ? ",true" : "") + "); }";
processing = 'if (this.cachedFragment) { dom.repairClonedNode(' + parent + ',' + quoting.array(blankChildTextNodes) + (isElementChecked ? ',true' : '') + '); }';
this.fragmentProcessing.push(processing);

@@ -239,3 +239,3 @@ };

var elementNodesName = "element" + elementNum;
this.fragmentProcessing.push("var " + elementNodesName + " = " + this.getParent() + ";");
this.fragmentProcessing.push('var ' + elementNodesName + ' = ' + this.getParent() + ';');
this.parents[this.parents.length - 1] = [elementNodesName];

@@ -263,3 +263,3 @@ };

return "dom.childAt(" + frag + ", [" + last.join(", ") + "])";
return 'dom.childAt(' + frag + ', [' + last.join(', ') + '])';
};

@@ -266,0 +266,0 @@

@@ -11,3 +11,3 @@ 'use strict';

for (var i = 0, len = element.attributes.length; i < len; i++) {
if (element.attributes[i].name === "checked") {
if (element.attributes[i].name === 'checked') {
return true;

@@ -61,7 +61,7 @@ }

for (var i = 0; i < blockParams.length; i++) {
this.opcode("printSetHook", blockParams[i], i);
this.opcode('printSetHook', blockParams[i], i);
}
if (blankChildTextNodes.length > 0) {
this.opcode("repairClonedNode", blankChildTextNodes);
this.opcode('repairClonedNode', blankChildTextNodes);
}

@@ -71,3 +71,3 @@ };

HydrationOpcodeCompiler.prototype.insertBoundary = function (first) {
this.opcode(first ? "openBoundary" : "closeBoundary");
this.opcode(first ? 'openBoundary' : 'closeBoundary');
};

@@ -93,3 +93,3 @@

this.opcode("consumeParent", this.currentDOMChildIndex);
this.opcode('consumeParent', this.currentDOMChildIndex);

@@ -103,3 +103,3 @@ // If our parent reference will be used more than once, cache its reference.

if (blankChildTextNodes.length > 0 || isElementChecked) {
this.opcode("repairClonedNode", blankChildTextNodes, isElementChecked);
this.opcode('repairClonedNode', blankChildTextNodes, isElementChecked);
}

@@ -116,3 +116,3 @@

distributeMorphs(this.morphs, this.opcodes);
this.opcode("popParent");
this.opcode('popParent');
this.currentDOMChildIndex = this.paths.pop();

@@ -130,6 +130,6 @@ };

preparePath(this, mustache.path);
opcode = "printInlineHook";
opcode = 'printInlineHook';
} else {
preparePath(this, mustache.path);
opcode = "printContentHook";
opcode = 'printContentHook';
}

@@ -155,3 +155,3 @@

return ["loc", [source || null, [start.line, start.column], [end.line, end.column]]];
return ['loc', [source || null, [start.line, start.column], [end.line, end.column]]];
}

@@ -174,3 +174,3 @@

this.opcode("printBlockHook", templateId, inverseId, meta(block));
this.opcode('printBlockHook', templateId, inverseId, meta(block));
};

@@ -190,12 +190,12 @@

// TODO: Introduce context specific AST nodes to avoid switching here.
if (value.type === "TextNode") {
this.opcode("pushLiteral", value.chars);
} else if (value.type === "MustacheStatement") {
if (value.type === 'TextNode') {
this.opcode('pushLiteral', value.chars);
} else if (value.type === 'MustacheStatement') {
this.accept(htmlbars_syntax__utils.unwrapMustache(value));
} else if (value.type === "ConcatStatement") {
} else if (value.type === 'ConcatStatement') {
prepareParams(this, value.parts);
this.opcode("pushConcatHook", this.morphNum);
this.opcode('pushConcatHook', this.morphNum);
}
this.opcode("pushLiteral", name);
this.opcode('pushLiteral', name);
}

@@ -208,5 +208,5 @@

this.opcode("prepareObject", attrs.length);
this.opcode("pushLiteral", component.tag);
this.opcode("printComponentHook", this.templateId++, blockParams.length, meta(component));
this.opcode('prepareObject', attrs.length);
this.opcode('pushLiteral', component.tag);
this.opcode('printComponentHook', this.templateId++, blockParams.length, meta(component));
};

@@ -220,13 +220,13 @@

// TODO: Introduce context specific AST nodes to avoid switching here.
if (value.type === "TextNode") {
if (value.type === 'TextNode') {
return;
} else if (value.type === "MustacheStatement") {
} else if (value.type === 'MustacheStatement') {
escaped = value.escaped;
this.accept(htmlbars_syntax__utils.unwrapMustache(value));
} else if (value.type === "ConcatStatement") {
} else if (value.type === 'ConcatStatement') {
prepareParams(this, value.parts);
this.opcode("pushConcatHook", this.morphNum);
this.opcode('pushConcatHook', this.morphNum);
}
this.opcode("pushLiteral", attr.name);
this.opcode('pushLiteral', attr.name);

@@ -239,4 +239,4 @@ var attrMorphNum = this.morphNum++;

this.opcode("createAttrMorph", attrMorphNum, this.elementNum, attr.name, escaped, namespace);
this.opcode("printAttributeHook");
this.opcode('createAttrMorph', attrMorphNum, this.elementNum, attr.name, escaped, namespace);
this.opcode('printAttributeHook');
};

@@ -255,3 +255,3 @@

publishElementMorph(this);
this.opcode("printElementHook", meta(modifier));
this.opcode('printElementHook', meta(modifier));
};

@@ -262,6 +262,6 @@

if (childIndex === 0) {
this.opcode("openBoundary");
this.opcode('openBoundary');
}
if (childIndex === childCount - 1) {
this.opcode("closeBoundary");
this.opcode('closeBoundary');
}

@@ -276,3 +276,3 @@ }

preparePath(this, mustache.path);
this.opcode("pushSexprHook", meta(mustache));
this.opcode('pushSexprHook', meta(mustache));
};

@@ -284,31 +284,31 @@

preparePath(this, sexpr.path);
this.opcode("pushSexprHook", meta(sexpr));
this.opcode('pushSexprHook', meta(sexpr));
};
HydrationOpcodeCompiler.prototype.PathExpression = function (path) {
this.opcode("pushGetHook", path.original, meta(path));
this.opcode('pushGetHook', path.original, meta(path));
};
HydrationOpcodeCompiler.prototype.StringLiteral = function (node) {
this.opcode("pushLiteral", node.value);
this.opcode('pushLiteral', node.value);
};
HydrationOpcodeCompiler.prototype.BooleanLiteral = function (node) {
this.opcode("pushLiteral", node.value);
this.opcode('pushLiteral', node.value);
};
HydrationOpcodeCompiler.prototype.NumberLiteral = function (node) {
this.opcode("pushLiteral", node.value);
this.opcode('pushLiteral', node.value);
};
HydrationOpcodeCompiler.prototype.UndefinedLiteral = function (node) {
this.opcode("pushLiteral", node.value);
this.opcode('pushLiteral', node.value);
};
HydrationOpcodeCompiler.prototype.NullLiteral = function (node) {
this.opcode("pushLiteral", node.value);
this.opcode('pushLiteral', node.value);
};
function preparePath(compiler, path) {
compiler.opcode("pushLiteral", path.original);
compiler.opcode('pushLiteral', path.original);
}

@@ -322,3 +322,3 @@

compiler.opcode("prepareArray", params.length);
compiler.opcode('prepareArray', params.length);
}

@@ -334,10 +334,10 @@

compiler[value.type](value);
compiler.opcode("pushLiteral", key);
compiler.opcode('pushLiteral', key);
}
compiler.opcode("prepareObject", pairs.length);
compiler.opcode('prepareObject', pairs.length);
}
function shareElement(compiler) {
compiler.opcode("shareElement", ++compiler.elementNum);
compiler.opcode('shareElement', ++compiler.elementNum);
compiler.element = null; // Set element to null so we don't cache it twice

@@ -348,3 +348,3 @@ }

var morphNum = compiler.morphNum++;
compiler.opcode("createElementMorph", morphNum, compiler.elementNum);
compiler.opcode('createElementMorph', morphNum, compiler.elementNum);
}

@@ -361,3 +361,3 @@

var opcode = opcodes[o][0];
if (opcode === "shareElement" || opcode === "consumeParent" || opcode === "popParent") {
if (opcode === 'shareElement' || opcode === 'consumeParent' || opcode === 'popParent') {
break;

@@ -369,3 +369,3 @@ }

for (var i = 0; i < morphs.length; ++i) {
spliceArgs.push(["createMorph", morphs[i].slice()]);
spliceArgs.push(['createMorph', morphs[i].slice()]);
}

@@ -372,0 +372,0 @@ opcodes.splice.apply(opcodes, spliceArgs);

@@ -44,7 +44,7 @@ 'use strict';

if (action[0] === 'startProgram' && nextAction[0] in dynamicNodes) {
if (action[0] === "startProgram" && nextAction[0] in dynamicNodes) {
normalizedActions.push(['insertBoundary', [true]]);
}
if (nextAction[0] === 'endProgram' && action[0] in dynamicNodes) {
if (nextAction[0] === "endProgram" && action[0] in dynamicNodes) {
normalizedActions.push(['insertBoundary', [false]]);

@@ -102,5 +102,5 @@ }

var indent = quoting.repeat(' ', programDepth);
var indent = quoting.repeat(" ", programDepth);
var options = {
indent: indent + ' '
indent: indent + " "
};

@@ -123,3 +123,3 @@

return indent + ' ' + JSON.stringify(s);
}).join(',\n');
}).join(",\n");

@@ -126,0 +126,0 @@ var locals = JSON.stringify(hydrationPrograms.locals);

@@ -36,17 +36,17 @@ 'use strict';

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});

@@ -56,17 +56,17 @@

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});

@@ -36,21 +36,21 @@ 'use strict';

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});
test("subexr hook correctly handles false-like values", function () {
registerHelper("if", function (params) {
registerHelper('if', function (params) {
return params[0] ? params[1] : params[2];

@@ -60,6 +60,6 @@ });

var object = { val: true };
var template = compiler.compile("<div data-foo={{if val \"stuff\" \"\"}}></div>");
var template = compiler.compile('<div data-foo={{if val "stuff" ""}}></div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div data-foo=\"stuff\"></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div data-foo="stuff"></div>');

@@ -70,3 +70,3 @@ object.val = false;

htmlbars_test_helpers.equalTokens(result.fragment, "<div data-foo=\"\"></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div data-foo=""></div>');
});

@@ -48,9 +48,9 @@ 'use strict';

test("manualElement function honors namespaces", function () {
htmlbars_runtime.hooks.keywords["manual-element"] = {
htmlbars_runtime.hooks.keywords['manual-element'] = {
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
var attributes = {
version: "1.1"
version: '1.1'
};
var layout = render.manualElement("svg", attributes);
var layout = render.manualElement('svg', attributes);

@@ -61,3 +61,3 @@ hooks.hostBlock(morph, env, scope, template, inverse, null, visitor, function (options) {

render.manualElement(env, scope, "span", attributes, morph);
render.manualElement(env, scope, 'span', attributes, morph);
},

@@ -70,7 +70,7 @@

var template = compiler.compile("{{#manual-element}}<linearGradient><stop offset=\"{{startOffset}}\"></stop><stop offset=\"{{stopOffset}}\"></stop></linearGradient>{{/manual-element}}");
var template = compiler.compile('{{#manual-element}}<linearGradient><stop offset="{{startOffset}}"></stop><stop offset="{{stopOffset}}"></stop></linearGradient>{{/manual-element}}');
var result = template.render({ startOffset: 0.1, stopOffset: 0.6 }, env);
ok(result.fragment.childNodes[1] instanceof SVGElement);
ok(result.fragment.childNodes[1].childNodes[0] instanceof SVGLinearGradientElement);
htmlbars_test_helpers.equalTokens(result.fragment, "<svg version=\"1.1\"><linearGradient><stop offset=\"0.1\"></stop><stop offset=\"0.6\"></stop></linearGradient></svg>");
htmlbars_test_helpers.equalTokens(result.fragment, '<svg version="1.1"><linearGradient><stop offset="0.1"></stop><stop offset="0.6"></stop></linearGradient></svg>');
});

@@ -80,10 +80,10 @@

var attributes = {
class: "foo-bar"
class: 'foo-bar'
};
var layout = render.manualElement("input", attributes);
var layout = render.manualElement('input', attributes);
var fragment = layout.buildFragment(new DOMHelper['default']());
equal(fragment.childNodes.length, 1, "includes a single element");
equal(fragment.childNodes[0].childNodes.length, 0, "no child nodes were added to `<input>` because it is a void tag");
htmlbars_test_helpers.equalTokens(fragment, "<input class=\"foo-bar\">");
equal(fragment.childNodes.length, 1, 'includes a single element');
equal(fragment.childNodes[0].childNodes.length, 0, 'no child nodes were added to `<input>` because it is a void tag');
htmlbars_test_helpers.equalTokens(fragment, '<input class="foo-bar">');
});

@@ -93,7 +93,7 @@

var attributes = {
class: "foo-bar",
other: ["get", "other"]
class: 'foo-bar',
other: ['get', 'other']
};
var element = document.createElement("div");
var element = document.createElement('div');
var raw = render.attachAttributes(attributes);

@@ -107,4 +107,4 @@ raw.element = element;

equal(element.getAttribute("class"), "foo-bar", "the attribute was assigned");
equal(element.getAttribute("other"), "first", "the attribute was assigned");
equal(element.getAttribute('class'), "foo-bar", "the attribute was assigned");
equal(element.getAttribute('other'), "first", "the attribute was assigned");

@@ -114,4 +114,4 @@ self.other = "second";

equal(element.getAttribute("class"), "foo-bar", "the attribute was assigned");
equal(element.getAttribute("other"), "second", "the attribute was assigned");
equal(element.getAttribute('class'), "foo-bar", "the attribute was assigned");
equal(element.getAttribute('other'), "second", "the attribute was assigned");
});

@@ -138,4 +138,4 @@

var attributes = {
class: "foo-bar",
other: ["get", "other"]
class: 'foo-bar',
other: ['get', 'other']
};

@@ -142,0 +142,0 @@

@@ -12,3 +12,3 @@ 'use strict';

// themselves.
if (typeof node !== "object" || node === null) {
if (typeof node !== 'object' || node === null) {
ret.value = node;

@@ -20,9 +20,9 @@ return ret;

// can be used by manualElement
case "value":
case 'value':
ret.value = node[1];break;
case "get":
case 'get':
ret.value = this.get(node, env, scope);break;
case "subexpr":
case 'subexpr':
ret.value = this.subexpr(node, env, scope);break;
case "concat":
case 'concat':
ret.value = this.concat(node, env, scope);break;

@@ -120,3 +120,3 @@ }

if (morph.linkedResult) {
morph_utils.linkParams(env, scope, morph, "@content-helper", [morph.linkedResult], null);
morph_utils.linkParams(env, scope, morph, '@content-helper', [morph.linkedResult], null);
}

@@ -133,3 +133,3 @@ return;

morph_utils.linkParams(env, scope, morph, "@range", params, null);
morph_utils.linkParams(env, scope, morph, '@range', params, null);
env.hooks.range(morph, env, scope, path, params[0], visitor);

@@ -153,3 +153,3 @@ },

value = node[2];
var paramsAndHash = this.linkParamsAndHash(env, scope, morph, "@attribute", [value], null);
var paramsAndHash = this.linkParamsAndHash(env, scope, morph, '@attribute', [value], null);

@@ -156,0 +156,0 @@ morph.isDirty = morph.isSubtreeDirty = false;

@@ -48,4 +48,2 @@ 'use strict';

function wrap(template) {

@@ -175,3 +173,3 @@ if (template === null) {

return function (_key, blockArguments, self) {
if (typeof _key !== "string") {
if (typeof _key !== 'string') {
throw new Error("You must provide a string key when calling `yieldItem`; you provided " + _key);

@@ -203,3 +201,3 @@ }

if (handledMorphs[_key]) {
if (_key in handledMorphs) {
// In this branch we are dealing with a duplicate key. The strategy

@@ -217,3 +215,3 @@ // is to take the original key and append a counter to it that is

key = _key + "--z8mS2hvDW0A--" + count;
key = _key + '--z8mS2hvDW0A--' + count;
} else {

@@ -264,2 +262,3 @@ key = _key;

}
function hostYieldWithShadowTemplate(template, env, parentScope, morph, renderState, visitor) {

@@ -352,2 +351,3 @@ return function (shadowTemplate, env, self, blockArguments) {

*/
function createScope(env, parentScope) {

@@ -423,2 +423,3 @@ if (parentScope) {

*/
function bindShadowScope(env /*, parentScope, shadowScope */) {

@@ -447,2 +448,3 @@ return env.hooks.createFreshScope();

*/
function bindSelf(env, scope, self) {

@@ -471,2 +473,3 @@ scope.self = self;

*/
function bindLocal(env, scope, name, value) {

@@ -496,4 +499,5 @@ scope.localPresent[name] = true;

*/
function bindBlock(env, scope, block) {
var name = arguments[3] === undefined ? "default" : arguments[3];
var name = arguments.length <= 3 || arguments[3] === undefined ? 'default' : arguments[3];

@@ -551,2 +555,3 @@ scope.blocks[name] = block;

*/
function block(morph, env, scope, path, params, hash, template, inverse, visitor) {

@@ -580,7 +585,7 @@ if (handleRedirect(morph, env, scope, path, params, hash, template, inverse, visitor)) {

switch (redirect) {
case "component":
case 'component':
env.hooks.component(morph, env, scope, path, params, hash, { default: template, inverse: inverse }, visitor);break;
case "inline":
case 'inline':
env.hooks.inline(morph, env, scope, path, params, hash, visitor);break;
case "block":
case 'block':
env.hooks.block(morph, env, scope, path, params, hash, template, inverse, visitor);break;

@@ -606,3 +611,3 @@ default:

if (typeof keyword === "function") {
if (typeof keyword === 'function') {
return keyword(morph, env, scope, params, hash, template, inverse, visitor);

@@ -692,3 +697,4 @@ }

}
function linkRenderNode() {
function linkRenderNode() /* morph, env, scope, params, hash */{
return;

@@ -735,2 +741,3 @@ }

*/
function inline(morph, env, scope, path, params, hash, visitor) {

@@ -754,6 +761,6 @@ if (handleRedirect(morph, env, scope, path, params, hash, null, null, visitor)) {

morph.linkedResult = result.value;
morph_utils.linkParams(env, scope, morph, "@content-helper", [morph.linkedResult], null);
morph_utils.linkParams(env, scope, morph, '@content-helper', [morph.linkedResult], null);
}
if (result && "value" in result) {
if (result && 'value' in result) {
value = env.hooks.getValue(result.value);

@@ -801,3 +808,4 @@ hasValue = true;

}
function classify() {
function classify() /* env, scope, path */{
return null;

@@ -817,3 +825,3 @@ }

var to = env.hooks.getValue(hash.to) || "default";
var to = env.hooks.getValue(hash.to) || 'default';
if (scope.blocks[to]) {

@@ -826,3 +834,3 @@ scope.blocks[to](env, params, hash.self, morph, scope, visitor);

hasBlock: function (morph, env, scope, params) {
var name = env.hooks.getValue(params[0]) || "default";
var name = env.hooks.getValue(params[0]) || 'default';
return !!scope.blocks[name];

@@ -832,3 +840,3 @@ },

hasBlockParams: function (morph, env, scope, params) {
var name = env.hooks.getValue(params[0]) || "default";
var name = env.hooks.getValue(params[0]) || 'default';
return !!(scope.blocks[name] && scope.blocks[name].arity);

@@ -862,2 +870,3 @@ }

*/
function range(morph, env, scope, path, value, visitor) {

@@ -904,2 +913,3 @@ if (handleRedirect(morph, env, scope, path, [value], {}, null, null, visitor)) {

*/
function element(morph, env, scope, path, params, hash, visitor) {

@@ -937,2 +947,3 @@ if (handleRedirect(morph, env, scope, path, params, hash, null, null, visitor)) {

*/
function attribute(morph, env, scope, name, value) {

@@ -951,3 +962,3 @@ value = env.hooks.getValue(value);

var result = env.hooks.invokeHelper(null, env, scope, null, params, hash, helper, {});
if (result && "value" in result) {
if (result && 'value' in result) {
return env.hooks.getValue(result.value);

@@ -977,8 +988,9 @@ }

*/
function get(env, scope, path) {
if (path === "") {
if (path === '') {
return scope.self;
}
var keys = path.split(".");
var keys = path.split('.');
var value = env.hooks.getRoot(scope, keys[0])[0];

@@ -1044,2 +1056,3 @@

}
function hasHelper(env, scope, helperName) {

@@ -1053,3 +1066,6 @@ return env.helpers[helperName] !== undefined;

function bindScope() {}
function bindScope() /* env, scope */{
// this function is used to handle host-specified extensions to scope
// other than `self`, `locals` and `block`.
}

@@ -1105,6 +1121,3 @@ function updateScope(env, scope) {

};
/* morph, env, scope, params, hash */ /* env, scope, path */ /* env, scope */
// this function is used to handle host-specified extensions to scope
// other than `self`, `locals` and `block`.
exports.keywords = keywords;

@@ -55,3 +55,3 @@ 'use strict';

nodes.push({ state: {} });
this.statements.push(["attributes", attachAttributes(options.attributes)]);
this.statements.push(['attributes', attachAttributes(options.attributes)]);
}

@@ -96,2 +96,3 @@

};
function manualElement(tagName, attributes) {

@@ -101,3 +102,3 @@ var statements = [];

for (var key in attributes) {
if (typeof attributes[key] === "string") {
if (typeof attributes[key] === 'string') {
continue;

@@ -108,3 +109,3 @@ }

statements.push(["content", "yield"]);
statements.push(['content', 'yield']);

@@ -117,3 +118,3 @@ var template = {

var el0 = dom.createDocumentFragment();
if (tagName === "svg") {
if (tagName === 'svg') {
dom.setNamespace(svgNamespace);

@@ -124,3 +125,3 @@ }

for (var key in attributes) {
if (typeof attributes[key] !== "string") {
if (typeof attributes[key] !== 'string') {
continue;

@@ -145,3 +146,3 @@ }

for (var key in attributes) {
if (typeof attributes[key] === "string") {
if (typeof attributes[key] === 'string') {
continue;

@@ -167,3 +168,3 @@ }

for (var key in attributes) {
if (typeof attributes[key] === "string") {
if (typeof attributes[key] === 'string') {
continue;

@@ -184,3 +185,3 @@ }

for (var key in attributes) {
if (typeof attributes[key] !== "string") {
if (typeof attributes[key] !== 'string') {
continue;

@@ -198,3 +199,3 @@ }

for (var key in attributes) {
if (typeof attributes[key] === "string") {
if (typeof attributes[key] === 'string') {
continue;

@@ -287,15 +288,15 @@ }

switch (statement[0]) {
case "block":
case 'block':
visitor.block(statement, morph, env, scope, template, visitor);break;
case "inline":
case 'inline':
visitor.inline(statement, morph, env, scope, visitor);break;
case "content":
case 'content':
visitor.content(statement, morph, env, scope, visitor);break;
case "element":
case 'element':
visitor.element(statement, morph, env, scope, template, visitor);break;
case "attribute":
case 'attribute':
visitor.attribute(statement, morph, env, scope);break;
case "component":
case 'component':
visitor.component(statement, morph, env, scope, template, visitor);break;
case "attributes":
case 'attributes':
visitor.attributes(statement, morph, env, scope, this.fragment, visitor);break;

@@ -345,2 +346,3 @@ }

}
function createChildMorph(dom, parentMorph, contextualElement) {

@@ -347,0 +349,0 @@ var morph = Morph['default'].empty(dom, contextualElement || parentMorph.contextualElement);

@@ -21,7 +21,7 @@ 'use strict';

locEqual(ast, 1, 0, 5, 4, "outer program");
locEqual(ast, 1, 0, 5, 4, 'outer program');
// startColumn should be 13 not 2.
// This should be fixed upstream in Handlebars.
locEqual(ast.body[1].program, 2, 2, 4, 7, "nested program");
locEqual(ast.body[1].program, 2, 2, 4, 7, 'nested program');
});

@@ -32,4 +32,4 @@

locEqual(ast.body[1], 2, 2, 9, 8, "outer block");
locEqual(ast.body[1].program.body[0], 3, 4, 7, 13, "nested block");
locEqual(ast.body[1], 2, 2, 9, 8, 'outer block');
locEqual(ast.body[1].program.body[0], 3, 4, 7, 13, 'nested block');
});

@@ -40,4 +40,4 @@

locEqual(ast.body[1], 2, 4, 2, 11, "outer mustache");
locEqual(ast.body[3].program.body[1], 4, 11, 5, 10, "inner mustache");
locEqual(ast.body[1], 2, 4, 2, 11, 'outer mustache');
locEqual(ast.body[3].program.body[1], 4, 11, 5, 10, 'inner mustache');
});

@@ -48,3 +48,3 @@

locEqual(ast.body[1].modifiers[0], 2, 9, 4, 15, "element modifier");
locEqual(ast.body[1].modifiers[0], 2, 9, 4, 15, 'element modifier');
});

@@ -63,6 +63,6 @@

locEqual(section, 2, 4, 7, 14, "section element");
locEqual(br, 3, 6, 3, 10, "br element");
locEqual(div, 4, 6, 6, 12, "div element");
locEqual(hr, 5, 8, 5, 14, "hr element");
locEqual(section, 2, 4, 7, 14, 'section element');
locEqual(br, 3, 6, 3, 10, 'br element');
locEqual(div, 4, 6, 6, 12, 'div element');
locEqual(hr, 5, 8, 5, 14, 'hr element');
});

@@ -80,6 +80,6 @@

locEqual(page, 2, 4, 7, 14, "page component");
locEqual(header, 3, 6, 3, 29, "header component");
locEqual(input, 4, 6, 4, 18, "input component");
locEqual(footer, 5, 6, 6, 22, "footer component");
locEqual(page, 2, 4, 7, 14, 'page component');
locEqual(header, 3, 6, 3, 29, 'header component');
locEqual(input, 4, 6, 4, 18, 'input component');
locEqual(footer, 5, 6, 6, 22, 'footer component');
});

@@ -10,3 +10,3 @@ 'use strict';

function normalizeNode(obj) {
if (obj && typeof obj === "object") {
if (obj && typeof obj === 'object') {
var newObj;

@@ -46,6 +46,6 @@ if (obj.splice) {

if (typeof actual === "string") {
if (typeof actual === 'string') {
actual = parser.preprocess(actual);
}
if (typeof expected === "string") {
if (typeof expected === 'string') {
expected = parser.preprocess(expected);

@@ -61,4 +61,4 @@ }

test("a simple piece of content", function () {
var t = "some content";
astEqual(t, b['default'].program([b['default'].text("some content")]));
var t = 'some content';
astEqual(t, b['default'].program([b['default'].text('some content')]));
});

@@ -75,7 +75,7 @@

astEqual(ast, b['default'].program([b['default'].element("h1", [], [], [b['default'].text("some")]), b['default'].text(" ast "), b['default'].mustache(b['default'].path("foo"))]));
astEqual(ast, b['default'].program([b['default'].element("h1", [], [], [b['default'].text("some")]), b['default'].text(" ast "), b['default'].mustache(b['default'].path('foo'))]));
});
test("self-closed element", function () {
var t = "<g />";
var t = '<g />';
astEqual(t, b['default'].program([b['default'].element("g")]));

@@ -85,3 +85,3 @@ });

test("elements can have empty attributes", function () {
var t = "<img id=\"\">";
var t = '<img id="">';
astEqual(t, b['default'].program([b['default'].element("img", [b['default'].attr("id", b['default'].text(""))])]));

@@ -96,3 +96,3 @@ });

test("html content with html content inline", function () {
var t = "<div><p></p></div>";
var t = '<div><p></p></div>';
astEqual(t, b['default'].program([b['default'].element("div", [], [], [b['default'].element("p")])]));

@@ -102,10 +102,10 @@ });

test("html content with svg content inline", function () {
var t = "<div><svg></svg></div>";
var t = '<div><svg></svg></div>';
astEqual(t, b['default'].program([b['default'].element("div", [], [], [b['default'].element("svg")])]));
});
var integrationPoints = ["foreignObject", "desc", "title"];
var integrationPoints = ['foreignObject', 'desc', 'title'];
function buildIntegrationPointTest(integrationPoint) {
return function integrationPointTest() {
var t = "<svg><" + integrationPoint + "><div></div></" + integrationPoint + "></svg>";
var t = '<svg><' + integrationPoint + '><div></div></' + integrationPoint + '></svg>';
astEqual(t, b['default'].program([b['default'].element("svg", [], [], [b['default'].element(integrationPoint, [], [], [b['default'].element("div")])])]));

@@ -119,3 +119,3 @@ };

test("a piece of content with HTML", function () {
var t = "some <div>content</div> done";
var t = 'some <div>content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].text("content")]), b['default'].text(" done")]));

@@ -125,24 +125,24 @@ });

test("a piece of Handlebars with HTML", function () {
var t = "some <div>{{content}}</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].mustache(b['default'].path("content"))]), b['default'].text(" done")]));
var t = 'some <div>{{content}}</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].mustache(b['default'].path('content'))]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (quoted)", function () {
var t = "some <div class=\"{{foo}}\">content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path("foo")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class="{{foo}}">content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path('foo')]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (unquoted)", function () {
var t = "some <div class={{foo}}>content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].mustache(b['default'].path("foo")))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class={{foo}}>content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].mustache(b['default'].path('foo')))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (sexprs)", function () {
var t = "some <div class=\"{{foo (foo \"abc\")}}\">content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].mustache(b['default'].path("foo"), [b['default'].sexpr(b['default'].path("foo"), [b['default'].string("abc")])])]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class="{{foo (foo "abc")}}">content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].mustache(b['default'].path('foo'), [b['default'].sexpr(b['default'].path('foo'), [b['default'].string('abc')])])]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute with other content surrounding it", function () {
var t = "some <a href=\"http://{{link}}/\">content</a> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("a", [b['default'].attr("href", b['default'].concat([b['default'].string("http://"), b['default'].path("link"), b['default'].string("/")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <a href="http://{{link}}/">content</a> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("a", [b['default'].attr("href", b['default'].concat([b['default'].string("http://"), b['default'].path('link'), b['default'].string("/")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});

@@ -152,3 +152,3 @@

var t = "{{embed}} {{some 'content'}} " + "<div class='{{foo}} {{bind-class isEnabled truthy='enabled'}}'>{{ content }}</div>" + " {{more 'embed'}}";
astEqual(t, b['default'].program([b['default'].mustache(b['default'].path("embed")), b['default'].text(" "), b['default'].mustache(b['default'].path("some"), [b['default'].string("content")]), b['default'].text(" "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path("foo"), b['default'].string(" "), b['default'].mustache(b['default'].path("bind-class"), [b['default'].path("isEnabled")], b['default'].hash([b['default'].pair("truthy", b['default'].string("enabled"))]))]))], [], [b['default'].mustache(b['default'].path("content"))]), b['default'].text(" "), b['default'].mustache(b['default'].path("more"), [b['default'].string("embed")])]));
astEqual(t, b['default'].program([b['default'].mustache(b['default'].path('embed')), b['default'].text(' '), b['default'].mustache(b['default'].path('some'), [b['default'].string('content')]), b['default'].text(' '), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path('foo'), b['default'].string(' '), b['default'].mustache(b['default'].path('bind-class'), [b['default'].path('isEnabled')], b['default'].hash([b['default'].pair('truthy', b['default'].string('enabled'))]))]))], [], [b['default'].mustache(b['default'].path('content'))]), b['default'].text(' '), b['default'].mustache(b['default'].path('more'), [b['default'].string('embed')])]));
});

@@ -158,8 +158,8 @@

var t = "{{#if foo}}<div>{{content}}</div>{{/if}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("if"), [b['default'].path("foo")], b['default'].hash(), b['default'].program([b['default'].element("div", [], [], [b['default'].mustache(b['default'].path("content"))])]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('if'), [b['default'].path('foo')], b['default'].hash(), b['default'].program([b['default'].element('div', [], [], [b['default'].mustache(b['default'].path('content'))])]))]));
});
test("Involved block helper", function () {
var t = "<p>hi</p> content {{#testing shouldRender}}<p>Appears!</p>{{/testing}} more <em>content</em> here";
astEqual(t, b['default'].program([b['default'].element("p", [], [], [b['default'].text("hi")]), b['default'].text(" content "), b['default'].block(b['default'].path("testing"), [b['default'].path("shouldRender")], b['default'].hash(), b['default'].program([b['default'].element("p", [], [], [b['default'].text("Appears!")])])), b['default'].text(" more "), b['default'].element("em", [], [], [b['default'].text("content")]), b['default'].text(" here")]));
var t = '<p>hi</p> content {{#testing shouldRender}}<p>Appears!</p>{{/testing}} more <em>content</em> here';
astEqual(t, b['default'].program([b['default'].element('p', [], [], [b['default'].text('hi')]), b['default'].text(' content '), b['default'].block(b['default'].path('testing'), [b['default'].path('shouldRender')], b['default'].hash(), b['default'].program([b['default'].element('p', [], [], [b['default'].text('Appears!')])])), b['default'].text(' more '), b['default'].element('em', [], [], [b['default'].text('content')]), b['default'].text(' here')]));
});

@@ -169,3 +169,3 @@

var t = "<p {{action 'boom'}} class='bar'>Some content</p>";
astEqual(t, b['default'].program([b['default'].element("p", [b['default'].attr("class", b['default'].text("bar"))], [b['default'].elementModifier(b['default'].path("action"), [b['default'].string("boom")])], [b['default'].text("Some content")])]));
astEqual(t, b['default'].program([b['default'].element('p', [b['default'].attr('class', b['default'].text('bar'))], [b['default'].elementModifier(b['default'].path('action'), [b['default'].string('boom')])], [b['default'].text('Some content')])]));
});

@@ -175,3 +175,3 @@

var t = "<input{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -181,3 +181,3 @@

var t = "<input {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -187,3 +187,3 @@

var t = "<input foo{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text(""))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text(''))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -193,3 +193,3 @@

var t = "<input foo {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text(""))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text(''))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -199,3 +199,3 @@

var t = "<input foo=1 {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text("1"))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text('1'))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -205,3 +205,3 @@

var t = "<input foo='1'{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text("1"))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text('1'))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -211,6 +211,6 @@

var t = "foo {{~content}} bar";
astEqual(t, b['default'].program([b['default'].text("foo"), b['default'].mustache(b['default'].path("content")), b['default'].text(" bar")]));
astEqual(t, b['default'].program([b['default'].text('foo'), b['default'].mustache(b['default'].path('content')), b['default'].text(' bar')]));
t = "foo {{content~}} bar";
astEqual(t, b['default'].program([b['default'].text("foo "), b['default'].mustache(b['default'].path("content")), b['default'].text("bar")]));
astEqual(t, b['default'].program([b['default'].text('foo '), b['default'].mustache(b['default'].path('content')), b['default'].text('bar')]));
});

@@ -220,6 +220,6 @@

var t = "foo {{~#wat}}{{/wat}} bar";
astEqual(t, b['default'].program([b['default'].text("foo"), b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program()), b['default'].text(" bar")]));
astEqual(t, b['default'].program([b['default'].text('foo'), b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program()), b['default'].text(' bar')]));
t = "foo {{#wat}}{{/wat~}} bar";
astEqual(t, b['default'].program([b['default'].text("foo "), b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program()), b['default'].text("bar")]));
astEqual(t, b['default'].program([b['default'].text('foo '), b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program()), b['default'].text('bar')]));
});

@@ -229,12 +229,12 @@

var t = "{{#wat~}} foo {{else}}{{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program([b['default'].text("foo ")]), b['default'].program())]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program([b['default'].text('foo ')]), b['default'].program())]));
t = "{{#wat}} foo {{~else}}{{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program([b['default'].text(" foo")]), b['default'].program())]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program([b['default'].text(' foo')]), b['default'].program())]));
t = "{{#wat}}{{else~}} foo {{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text("foo ")]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text('foo ')]))]));
t = "{{#wat}}{{else}} foo {{~/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text(" foo")]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text(' foo')]))]));
});

@@ -244,3 +244,3 @@

var t = "{{#each~}}\n <li> foo </li>\n{{~/each}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("each"), [], b['default'].hash(), b['default'].program([b['default'].element("li", [], [], [b['default'].text(" foo ")])]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('each'), [], b['default'].hash(), b['default'].program([b['default'].element('li', [], [], [b['default'].text(' foo ')])]))]));
});

@@ -268,3 +268,3 @@

var t = "<x-foo a=b c='d' e={{f}} id='{{bar}}' class='foo-{{bar}}'>{{a}}{{b}}c{{d}}</x-foo>{{e}}";
astEqual(t, b['default'].program([b['default'].component("x-foo", [b['default'].attr("a", b['default'].text("b")), b['default'].attr("c", b['default'].text("d")), b['default'].attr("e", b['default'].mustache(b['default'].path("f"))), b['default'].attr("id", b['default'].concat([b['default'].path("bar")])), b['default'].attr("class", b['default'].concat([b['default'].string("foo-"), b['default'].path("bar")]))], b['default'].program([b['default'].mustache(b['default'].path("a")), b['default'].mustache(b['default'].path("b")), b['default'].text("c"), b['default'].mustache(b['default'].path("d"))])), b['default'].mustache(b['default'].path("e"))]));
astEqual(t, b['default'].program([b['default'].component('x-foo', [b['default'].attr('a', b['default'].text('b')), b['default'].attr('c', b['default'].text('d')), b['default'].attr('e', b['default'].mustache(b['default'].path('f'))), b['default'].attr('id', b['default'].concat([b['default'].path('bar')])), b['default'].attr('class', b['default'].concat([b['default'].string('foo-'), b['default'].path('bar')]))], b['default'].program([b['default'].mustache(b['default'].path('a')), b['default'].mustache(b['default'].path('b')), b['default'].text('c'), b['default'].mustache(b['default'].path('d'))])), b['default'].mustache(b['default'].path('e'))]));
});

@@ -291,3 +291,3 @@

test("an HTML comment", function () {
var t = "before <!-- some comment --> after";
var t = 'before <!-- some comment --> after';
astEqual(t, b['default'].program([b['default'].text("before "), b['default'].comment(" some comment "), b['default'].text(" after")]));

@@ -305,3 +305,3 @@ });

astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path("foo"), [b['default'].null()])]));
astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path('foo'), [b['default'].null()])]));
});

@@ -318,3 +318,3 @@

astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path("foo"), [b['default'].undefined()])]));
astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path('foo'), [b['default'].undefined()])]));
});

@@ -6,5 +6,5 @@ 'use strict';

QUnit.module("Compiler plugins: AST");
QUnit.module('Compiler plugins: AST');
test("AST plugins can be provided to the compiler", function () {
test('AST plugins can be provided to the compiler', function () {
expect(1);

@@ -14,6 +14,6 @@

Plugin.prototype.transform = function () {
ok(true, "transform was called!");
ok(true, 'transform was called!');
};
parser.preprocess("<div></div>", {
parser.preprocess('<div></div>', {
plugins: {

@@ -25,3 +25,3 @@ ast: [Plugin]

test("provides syntax package as `syntax` prop if value is null", function () {
test('provides syntax package as `syntax` prop if value is null', function () {
expect(1);

@@ -34,3 +34,3 @@

parser.preprocess("<div></div>", {
parser.preprocess('<div></div>', {
plugins: {

@@ -42,3 +42,3 @@ ast: [Plugin]

test("AST plugins can modify the AST", function () {
test('AST plugins can modify the AST', function () {
expect(1);

@@ -53,3 +53,3 @@

var ast = parser.preprocess("<div></div>", {
var ast = parser.preprocess('<div></div>', {
plugins: {

@@ -60,6 +60,6 @@ ast: [Plugin]

equal(ast, expected, "return value from AST transform is used");
equal(ast, expected, 'return value from AST transform is used');
});
test("AST plugins can be chained", function () {
test('AST plugins can be chained', function () {
expect(2);

@@ -76,8 +76,8 @@

SecondaryPlugin.prototype.transform = function (ast) {
equal(ast, expected, "return value from AST transform is used");
equal(ast, expected, 'return value from AST transform is used');
return "BOOM!";
return 'BOOM!';
};
var ast = parser.preprocess("<div></div>", {
var ast = parser.preprocess('<div></div>', {
plugins: {

@@ -88,3 +88,3 @@ ast: [Plugin, SecondaryPlugin]

equal(ast, "BOOM!", "return value from last AST transform is used");
equal(ast, 'BOOM!', 'return value from last AST transform is used');
});

@@ -135,3 +135,3 @@ 'use strict';

original: original,
parts: original.split(".")
parts: original.split('.')
};

@@ -212,4 +212,4 @@ }

return {
line: typeof line === "number" ? line : null,
column: typeof column === "number" ? column : null
line: typeof line === 'number' ? line : null,
column: typeof column === 'number' ? column : null
};

@@ -222,3 +222,3 @@ }

if (typeof loc === "object") {
if (typeof loc === 'object') {
return {

@@ -225,0 +225,0 @@ source: buildSource(loc.source),

@@ -137,3 +137,4 @@ 'use strict';

scopedId: function (path) {
return /^\.|this\b/.test(path.original);
return (/^\.|this\b/.test(path.original)
);
},

@@ -140,0 +141,0 @@

@@ -11,6 +11,5 @@ 'use strict';

var yy = {};
utils.extend(yy, Helpers, AST['default']);
function parse(input, options) {

@@ -17,0 +16,0 @@ // Just return if an already-compiled AST was passed in.

@@ -14,4 +14,2 @@ 'use strict';

function SourceLocation(source, locInfo) {

@@ -91,3 +89,3 @@ this.source = source;

throw new Exception['default'](openRawBlock.path.original + ' doesn\'t match ' + close, errorNode);
throw new Exception['default'](openRawBlock.path.original + " doesn't match " + close, errorNode);
}

@@ -94,0 +92,0 @@

@@ -353,4 +353,4 @@ 'use strict';

this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 };

@@ -415,3 +415,3 @@ if (this.options.ranges) this.yylloc.range = [0, 0];

var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
},

@@ -423,3 +423,3 @@ upcomingInput: function () {

}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
},

@@ -439,4 +439,4 @@ showPosition: function () {

if (!this._more) {
this.yytext = "";
this.match = "";
this.yytext = '';
this.match = '';
}

@@ -476,3 +476,3 @@ var rules = this._currentRules();

} else {
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno });
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno });
}

@@ -482,3 +482,3 @@ },

var r = this.next();
if (typeof r !== "undefined") {
if (typeof r !== 'undefined') {
return r;

@@ -559,3 +559,3 @@ } else {

this.popState();
this.begin("raw");
this.begin('raw');
return 21;

@@ -594,3 +594,3 @@

this.popState();
this.begin("com");
this.begin('com');

@@ -628,3 +628,3 @@ break;

case 29:
yy_.yytext = strip(1, 2).replace(/\\"/g, "\"");return 74;
yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 74;
break;

@@ -665,3 +665,3 @@ case 30:

case 41:
return "INVALID";
return 'INVALID';
break;

@@ -668,0 +668,0 @@ case 42:

@@ -96,4 +96,4 @@ 'use strict';

ContentStatement: function () {},
CommentStatement: function () {},
ContentStatement: function () /* content */{},
CommentStatement: function () /* comment */{},

@@ -106,9 +106,9 @@ SubExpression: function (sexpr) {

PathExpression: function () {},
PathExpression: function () /* path */{},
StringLiteral: function () {},
NumberLiteral: function () {},
BooleanLiteral: function () {},
UndefinedLiteral: function () {},
NullLiteral: function () {},
StringLiteral: function () /* string */{},
NumberLiteral: function () /* number */{},
BooleanLiteral: function () /* bool */{},
UndefinedLiteral: function () /* literal */{},
NullLiteral: function () /* literal */{},

@@ -123,3 +123,2 @@ Hash: function (hash) {

exports['default'] = Visitor;
/* content */ /* comment */ /* path */ /* string */ /* number */ /* bool */ /* literal */ /* literal */
exports['default'] = Visitor;

@@ -15,3 +15,3 @@ 'use strict';

'"': '&quot;',
'\'': '&#x27;',
"'": '&#x27;',
'`': '&#x60;'

@@ -26,2 +26,3 @@ };

}
function extend(obj /* , ...source */) {

@@ -28,0 +29,0 @@ for (var i = 1; i < arguments.length; i++) {

@@ -14,6 +14,4 @@ 'use strict';

function preprocess(html, options) {
var ast = typeof html === "object" ? html : base.parse(html);
var ast = typeof html === 'object' ? html : base.parse(html);
var combined = new Parser(html, options).acceptNode(ast);

@@ -37,2 +35,3 @@

var entityParser = new EntityParser['default'](fullCharRefs['default']);
function Parser(source, options) {

@@ -46,3 +45,3 @@ this.options = options || {};

if (typeof source === "string") {
if (typeof source === 'string') {
this.source = source.split(/(?:\r\n?|\n)/g);

@@ -78,3 +77,3 @@ }

if (!this.source) {
return "{{" + mustache.path.id.original + "}}";
return '{{' + mustache.path.id.original + '}}';
}

@@ -99,3 +98,3 @@

return string.join("\n");
return string.join('\n');
};

@@ -38,8 +38,8 @@ 'use strict';

if (this.tokenizer.state === "comment") {
this.appendToCommentData("{{" + this.sourceForMustache(block) + "}}");
if (this.tokenizer.state === 'comment') {
this.appendToCommentData('{{' + this.sourceForMustache(block) + '}}');
return;
}
if (this.tokenizer.state !== "comment" && this.tokenizer.state !== "data" && this.tokenizer.state !== "beforeData") {
if (this.tokenizer.state !== 'comment' && this.tokenizer.state !== 'data' && this.tokenizer.state !== 'beforeData') {
throw new Error("A block may only be used inside an HTML element or another block.");

@@ -67,4 +67,4 @@ }

if (tokenizer.state === "comment") {
this.appendToCommentData("{{" + this.sourceForMustache(mustache) + "}}");
if (tokenizer.state === 'comment') {
this.appendToCommentData('{{' + this.sourceForMustache(mustache) + '}}');
return;

@@ -99,3 +99,3 @@ }

appendDynamicAttributeValuePart(this.currentAttribute, mustache);
tokenizer.state = "attributeValueUnquoted";
tokenizer.state = 'attributeValueUnquoted';
break;

@@ -164,3 +164,3 @@ case "attributeValueDoubleQuoted":

function leadingNewlineDifference(original, value) {
if (value === "") {
if (value === '') {
// if it is empty, just return the count of newlines

@@ -167,0 +167,0 @@ // in original

@@ -44,3 +44,3 @@ 'use strict';

this.currentNode = {
type: "StartTag",
type: 'StartTag',
name: "",

@@ -56,3 +56,3 @@ attributes: [],

this.currentNode = {
type: "EndTag",
type: 'EndTag',
name: "",

@@ -76,3 +76,3 @@ attributes: [],

if (tag.type === "StartTag") {
if (tag.type === 'StartTag') {
this.finishStartTag();

@@ -83,3 +83,3 @@

}
} else if (tag.type === "EndTag") {
} else if (tag.type === 'EndTag') {
this.finishEndTag(false);

@@ -136,3 +136,3 @@ }

var tag = this.currentNode;
if (tag.type === "EndTag") {
if (tag.type === 'EndTag') {
throw new Error("Invalid end tag: closing tag must not have attributes, " + ("in `" + tag.name + "` (on line " + this.tokenizer.line + ")."));

@@ -160,3 +160,3 @@ }

if (typeof parts[parts.length - 1] === "string") {
if (typeof parts[parts.length - 1] === 'string') {
parts[parts.length - 1] += char;

@@ -201,6 +201,6 @@ } else {

if (typeof part === "string") {
if (typeof part === 'string') {
parts[i] = b['default'].string(parts[i]);
} else {
if (part.type === "MustacheStatement") {
if (part.type === 'MustacheStatement') {
parts[i] = utils.unwrapMustache(part);

@@ -207,0 +207,0 @@ } else {

@@ -11,4 +11,2 @@ 'use strict';

var ID_INVERSE_PATTERN = /[!"#%-,\.\/;->@\[-\^`\{-~]/;

@@ -15,0 +13,0 @@

@@ -13,4 +13,2 @@ 'use strict';

function equalInnerHTML(fragment, html) {

@@ -40,3 +38,3 @@ var actualHTML = normalizeInnerHTML(fragment.innerHTML);

var div = document.createElement("div");
if (typeof fragmentOrHtml === "string") {
if (typeof fragmentOrHtml === 'string') {
div.innerHTML = fragmentOrHtml;

@@ -49,2 +47,3 @@ } else {

}
function equalTokens(fragment, html, message) {

@@ -62,3 +61,3 @@ if (fragment.fragment) {

function normalizeTokens(token) {
if (token.type === "StartTag") {
if (token.type === 'StartTag') {
token.attributes = token.attributes.sort(function (a, b) {

@@ -93,8 +92,9 @@ if (a[0] > b[0]) {

}
var div = document.createElement("div");
var node = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var div = document.createElement('div');
var node = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
div.appendChild(node);
var clone = div.cloneNode(true);
return clone.innerHTML === "<svg xmlns=\"http://www.w3.org/2000/svg\" />";
return clone.innerHTML === '<svg xmlns="http://www.w3.org/2000/svg" />';
})();
function normalizeInnerHTML(actualHTML) {

@@ -104,6 +104,6 @@ if (ieSVGInnerHTML) {

// drop namespace attribute
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, "");
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, '');
// replace self-closing elements
actualHTML = actualHTML.replace(/<([^ >]+) [^\/>]*\/>/gi, function (tag, tagName) {
return tag.slice(0, tag.length - 3) + "></" + tagName + ">";
return tag.slice(0, tag.length - 3) + '></' + tagName + '>';
});

@@ -116,5 +116,6 @@ }

// detect weird IE8 checked element string
var checkedInput = document.createElement("input");
checkedInput.setAttribute("checked", "checked");
var checkedInput = document.createElement('input');
checkedInput.setAttribute('checked', 'checked');
var checkedInputString = checkedInput.outerHTML;
function isCheckedInputHTML(element) {

@@ -125,3 +126,4 @@ equal(element.outerHTML, checkedInputString);

// check which property has the node's text content
var textProperty = document.createElement("div").textContent === undefined ? "innerText" : "textContent";
var textProperty = document.createElement('div').textContent === undefined ? 'innerText' : 'textContent';
function getTextContent(el) {

@@ -128,0 +130,0 @@ // textNode

@@ -5,6 +5,6 @@ 'use strict';

QUnit.module("htmlbars");
QUnit.module('htmlbars');
test("compile is exported", function () {
ok(typeof htmlbars.compile === "function", "compile is exported");
ok(typeof htmlbars.compile === 'function', 'compile is exported');
});

@@ -5,6 +5,6 @@ 'use strict';

QUnit.module("htmlbars-util");
QUnit.module('htmlbars-util');
test("SafeString is exported", function () {
ok(typeof htmlbars_util.SafeString === "function", "SafeString is exported");
ok(typeof htmlbars_util.SafeString === 'function', 'SafeString is exported');
});

@@ -15,3 +15,3 @@ 'use strict';

'"': '&quot;',
'\'': '&#x27;',
"'": '&#x27;',
'`': '&#x60;'

@@ -26,2 +26,3 @@ };

}
function extend(obj /* , ...source */) {

@@ -28,0 +29,0 @@ for (var i = 1; i < arguments.length; i++) {

@@ -12,2 +12,3 @@ 'use strict';

};
function getAttrNamespace(attrName) {

@@ -14,0 +15,0 @@ var namespace;

@@ -11,3 +11,3 @@ 'use strict';

str = str.replace(/\\/g, "\\\\");
str = str.replace(/"/g, "\\\"");
str = str.replace(/"/g, '\\"');
str = str.replace(/\n/g, "\\n");

@@ -18,3 +18,3 @@ return str;

function string(str) {
return "\"" + escapeString(str) + "\"";
return '"' + escapeString(str) + '"';
}

@@ -21,0 +21,0 @@

@@ -11,4 +11,2 @@ 'use strict';

function RenderState(renderNode, morphList) {

@@ -76,3 +74,3 @@ // The morph list that is no longer needed and can be

}
if (typeof blocks === "function") {
if (typeof blocks === 'function') {
env.hooks.bindBlock(env, shadowScope, blocks);

@@ -87,2 +85,3 @@ } else {

}
function renderAndCleanup(morph, env, options, shadowOptions, callback) {

@@ -89,0 +88,0 @@ // The RenderState object is used to collect information about what the

@@ -12,3 +12,3 @@ 'use strict';

* See https://raw.githubusercontent.com/tildeio/htmlbars/master/LICENSE
* @version 0.13.34.c418c83b
* @version v0.13.35
*/

@@ -15,0 +15,0 @@

@@ -12,10 +12,10 @@ 'use strict';

QUnit.module("AttrMorph");
QUnit.module('AttrMorph');
test("can update a dom node", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
morph.setContent("twang");
equal(element.id, "twang", "id property is set");
equal(element.getAttribute("id"), "twang", "id attribute is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent('twang');
equal(element.id, 'twang', 'id property is set');
equal(element.getAttribute('id'), 'twang', 'id attribute is set');
});

@@ -25,4 +25,4 @@

expect(0);
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.clear();

@@ -33,68 +33,68 @@ });

expect(1);
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.destroy();
equal(morph.element, null, "clears element from morph");
equal(morph.element, null, 'clears element from morph');
});
test("can update property", function () {
var element = domHelper.createElement("input");
var morph = domHelper.createAttrMorph(element, "disabled");
var element = domHelper.createElement('input');
var morph = domHelper.createAttrMorph(element, 'disabled');
morph.setContent(true);
equal(element.disabled, true, "disabled property is set");
equal(element.disabled, true, 'disabled property is set');
morph.setContent(false);
equal(element.disabled, false, "disabled property is set");
equal(element.disabled, false, 'disabled property is set');
});
test("does not add undefined properties on initial render", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent(undefined);
equal(element.id, "", "property should not be set");
morph.setContent("foo-bar");
equal(element.id, "foo-bar", "property should be set");
equal(element.id, '', 'property should not be set');
morph.setContent('foo-bar');
equal(element.id, 'foo-bar', 'property should be set');
});
test("does not add null properties on initial render", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent(null);
equal(element.id, "", "property should not be set");
morph.setContent("foo-bar");
equal(element.id, "foo-bar", "property should be set");
equal(element.id, '', 'property should not be set');
morph.setContent('foo-bar');
equal(element.id, 'foo-bar', 'property should be set');
});
test("can update attribute", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "data-bop");
morph.setContent("kpow");
equal(element.getAttribute("data-bop"), "kpow", "data-bop attribute is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'data-bop');
morph.setContent('kpow');
equal(element.getAttribute('data-bop'), 'kpow', 'data-bop attribute is set');
morph.setContent(null);
equal(element.getAttribute("data-bop"), undefined, "data-bop attribute is removed");
equal(element.getAttribute('data-bop'), undefined, 'data-bop attribute is removed');
});
test("can remove ns attribute with null", function () {
var element = domHelper.createElement("svg");
domHelper.setAttribute(element, "xlink:title", "Great Title", xlinkNamespace);
var morph = domHelper.createAttrMorph(element, "xlink:title", xlinkNamespace);
var element = domHelper.createElement('svg');
domHelper.setAttribute(element, 'xlink:title', 'Great Title', xlinkNamespace);
var morph = domHelper.createAttrMorph(element, 'xlink:title', xlinkNamespace);
morph.setContent(null);
equal(element.getAttribute("xlink:title"), undefined, "ns attribute is removed");
equal(element.getAttribute('xlink:title'), undefined, 'ns attribute is removed');
});
test("can remove attribute with undefined", function () {
var element = domHelper.createElement("div");
element.setAttribute("data-bop", "kpow");
var morph = domHelper.createAttrMorph(element, "data-bop");
var element = domHelper.createElement('div');
element.setAttribute('data-bop', 'kpow');
var morph = domHelper.createAttrMorph(element, 'data-bop');
morph.setContent(undefined);
equal(element.getAttribute("data-bop"), undefined, "data-bop attribute is removed");
equal(element.getAttribute('data-bop'), undefined, 'data-bop attribute is removed');
});
test("can remove ns attribute with undefined", function () {
var element = domHelper.createElement("svg");
domHelper.setAttribute(element, "xlink:title", "Great Title", xlinkNamespace);
var morph = domHelper.createAttrMorph(element, "xlink:title", xlinkNamespace);
var element = domHelper.createElement('svg');
domHelper.setAttribute(element, 'xlink:title', 'Great Title', xlinkNamespace);
var morph = domHelper.createAttrMorph(element, 'xlink:title', xlinkNamespace);
morph.setContent(undefined);
equal(element.getAttribute("xlink:title"), undefined, "ns attribute is removed");
equal(element.getAttribute('xlink:title'), undefined, 'ns attribute is removed');
});

@@ -104,20 +104,20 @@

domHelper.setNamespace(svgNamespace);
var element = domHelper.createElement("svg");
var morph = domHelper.createAttrMorph(element, "height");
morph.setContent("50%");
equal(element.getAttribute("height"), "50%", "svg attr is set");
var element = domHelper.createElement('svg');
var morph = domHelper.createAttrMorph(element, 'height');
morph.setContent('50%');
equal(element.getAttribute('height'), '50%', 'svg attr is set');
morph.setContent(null);
equal(element.getAttribute("height"), undefined, "svg attr is removed");
equal(element.getAttribute('height'), undefined, 'svg attr is removed');
});
test("can update style attribute", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "style");
morph.setContent("color: red;");
equal(element.getAttribute("style"), "color: red;", "style attr is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'style');
morph.setContent('color: red;');
equal(element.getAttribute('style'), 'color: red;', 'style attr is set');
morph.setContent(null);
equal(element.getAttribute("style"), undefined, "style attr is removed");
equal(element.getAttribute('style'), undefined, 'style attr is removed');
});
var badTags = [{ tag: "a", attr: "href" }, { tag: "body", attr: "background" }, { tag: "link", attr: "href" }, { tag: "img", attr: "src" }, { tag: "iframe", attr: "src" }];
var badTags = [{ tag: 'a', attr: 'href' }, { tag: 'body', attr: 'background' }, { tag: 'link', attr: 'href' }, { tag: 'img', attr: 'src' }, { tag: 'iframe', attr: 'src' }];

@@ -131,5 +131,5 @@ for (var i = 0, l = badTags.length; i < l; i++) {

var morph = domHelper.createAttrMorph(element, subject.attr);
morph.setContent("javascript://example.com");
morph.setContent('javascript://example.com');
equal(element.getAttribute(subject.attr), "unsafe:javascript://example.com", "attribute is escaped");
equal(element.getAttribute(subject.attr), 'unsafe:javascript://example.com', 'attribute is escaped');
});

@@ -141,8 +141,8 @@

try {
morph.setContent(new SafeString['default']("javascript://example.com"));
morph.setContent(new SafeString['default']('javascript://example.com'));
equal(element.getAttribute(subject.attr), "javascript://example.com", "attribute is not escaped");
equal(element.getAttribute(subject.attr), 'javascript://example.com', 'attribute is not escaped');
} catch (e) {
// IE does not allow javascript: to be set on img src
ok(true, "caught exception " + e);
ok(true, 'caught exception ' + e);
}

@@ -155,8 +155,8 @@ });

try {
morph.setContent("javascript://example.com");
morph.setContent('javascript://example.com');
equal(element.getAttribute(subject.attr), "javascript://example.com", "attribute is not escaped");
equal(element.getAttribute(subject.attr), 'javascript://example.com', 'attribute is not escaped');
} catch (e) {
// IE does not allow javascript: to be set on img src
ok(true, "caught exception " + e);
ok(true, 'caught exception ' + e);
}

@@ -170,6 +170,6 @@ });

test("detects attribute's namespace if it is not passed as an argument", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "xlink:href");
morph.setContent("#circle");
equal(element.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink", "attribute has correct namespace");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'xlink:href');
morph.setContent('#circle');
equal(element.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink', 'attribute has correct namespace');
});

@@ -179,13 +179,13 @@

domHelper.setNamespace(svgNamespace);
var element = domHelper.createElement("svg");
var morph = domHelper.createAttrMorph(element, "xlink:href", "http://www.w3.org/1999/xlink");
morph.setContent("#other");
equal(element.getAttributeNS("http://www.w3.org/1999/xlink", "href"), "#other", "namespaced attr is set");
equal(element.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink");
equal(element.attributes[0].name, "xlink:href");
equal(element.attributes[0].localName, "href");
equal(element.attributes[0].value, "#other");
var element = domHelper.createElement('svg');
var morph = domHelper.createAttrMorph(element, 'xlink:href', 'http://www.w3.org/1999/xlink');
morph.setContent('#other');
equal(element.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), '#other', 'namespaced attr is set');
equal(element.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink');
equal(element.attributes[0].name, 'xlink:href');
equal(element.attributes[0].localName, 'href');
equal(element.attributes[0].value, '#other');
morph.setContent(null);
// safari returns '' while other browsers return undefined
equal(!!element.getAttributeNS("http://www.w3.org/1999/xlink", "href"), false, "namespaced attr is removed");
equal(!!element.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), false, 'namespaced attr is removed');
});

@@ -195,7 +195,7 @@ }

test("embed src as data uri is sanitized", function () {
var element = document.createElement("embed");
var morph = domHelper.createAttrMorph(element, "src");
morph.setContent("data:image/svg+xml;base64,PH");
var element = document.createElement('embed');
var morph = domHelper.createAttrMorph(element, 'src');
morph.setContent('data:image/svg+xml;base64,PH');
equal(element.getAttribute("src"), "unsafe:data:image/svg+xml;base64,PH", "attribute is escaped");
equal(element.getAttribute('src'), 'unsafe:data:image/svg+xml;base64,PH', 'attribute is escaped');
});

@@ -10,5 +10,5 @@ 'use strict';

QUnit.module("sanitizeAttributeValue(null, \"*\")");
QUnit.module('sanitizeAttributeValue(null, "*")');
var goodProtocols = ["https", "http", "ftp", "tel", "file"];
var goodProtocols = ['https', 'http', 'ftp', 'tel', 'file'];

@@ -20,13 +20,13 @@ for (var i = 0, l = goodProtocols.length; i < l; i++) {

function buildProtocolTest(protocol) {
test("allows " + protocol + " protocol when element is not provided", function () {
test('allows ' + protocol + ' protocol when element is not provided', function () {
expect(1);
var attributeValue = protocol + "://foo.com";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = protocol + '://foo.com';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, attributeValue, "protocol not escaped");
equal(actual, attributeValue, 'protocol not escaped');
});
}
test("blocks javascript: protocol", function () {
test('blocks javascript: protocol', function () {
/* jshint scripturl:true */

@@ -36,9 +36,9 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});
test("blocks blacklisted protocols", function () {
test('blocks blacklisted protocols', function () {
/* jshint scripturl:true */

@@ -48,9 +48,9 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});
test("does not block SafeStrings", function () {
test('does not block SafeStrings', function () {
/* jshint scripturl:true */

@@ -60,6 +60,6 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", new SafeString['default'](attributeValue));
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', new SafeString['default'](attributeValue));
equal(actual, attributeValue, "protocol unescaped");
equal(actual, attributeValue, 'protocol unescaped');
});

@@ -72,6 +72,6 @@

var attributeValue = "data:image/svg+xml;base64,...";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: "EMBED" }, "src", attributeValue);
var attributeValue = 'data:image/svg+xml;base64,...';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: 'EMBED' }, 'src', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});

@@ -84,13 +84,13 @@

var attributeValue = "data:image/svg+xml;base64,...";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: "IMG" }, "src", attributeValue);
var attributeValue = 'data:image/svg+xml;base64,...';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: 'IMG' }, 'src', attributeValue);
equal(actual, attributeValue, "protocol should not have been escaped");
equal(actual, attributeValue, 'protocol should not have been escaped');
});
var badTags = ["A", "BODY", "LINK", "IMG", "IFRAME", "BASE", "FORM"];
var badTags = ['A', 'BODY', 'LINK', 'IMG', 'IFRAME', 'BASE', 'FORM'];
var badAttributes = ["href", "src", "background", "action"];
var badAttributes = ['href', 'src', 'background', 'action'];
var someIllegalProtocols = ["javascript", "vbscript"];
var someIllegalProtocols = ['javascript', 'vbscript'];

@@ -100,4 +100,4 @@ array_utils.forEach(badTags, function (tagName) {

array_utils.forEach(someIllegalProtocols, function (protocol) {
test(" <" + tagName + " " + attrName + "=\"" + protocol + ":something\"> ...", function () {
equal(sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: tagName }, attrName, protocol + ":something"), "unsafe:" + protocol + ":something");
test(' <' + tagName + ' ' + attrName + '="' + protocol + ':something"> ...', function () {
equal(sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: tagName }, attrName, protocol + ':something'), 'unsafe:' + protocol + ':something');
});

@@ -104,0 +104,0 @@ });

@@ -78,3 +78,3 @@ 'use strict';

if (element.namespaceURI === build_html_dom.svgNamespace || attrName === "style" || type === "attr") {
if (element.namespaceURI === build_html_dom.svgNamespace || attrName === 'style' || type === 'attr') {
this._update = updateAttribute;

@@ -81,0 +81,0 @@ this._get = getAttribute;

@@ -34,2 +34,3 @@ 'use strict';

};
function sanitizeAttributeValue(dom, element, attribute, value) {

@@ -36,0 +37,0 @@ var tagName;

@@ -81,3 +81,3 @@ 'use strict';

if (morph.parentMorphList !== this) {
throw new Error('Cannot remove a morph from a parent it is not inside of');
throw new Error("Cannot remove a morph from a parent it is not inside of");
}

@@ -84,0 +84,0 @@

@@ -70,3 +70,3 @@ 'use strict';

if (char === '\n') {
if (char === "\n") {
this.line++;

@@ -94,3 +94,3 @@ this.column = 0;

if (char === '<') {
if (char === "<") {
this.state = 'tagOpen';

@@ -108,3 +108,3 @@ this.markTagStart();

if (char === '<') {
if (char === "<") {
this.delegate.finishData();

@@ -114,5 +114,5 @@ this.state = 'tagOpen';

this.consume();
} else if (char === '&') {
} else if (char === "&") {
this.consume();
this.delegate.appendToData(this.consumeCharRef() || '&');
this.delegate.appendToData(this.consumeCharRef() || "&");
} else {

@@ -127,5 +127,5 @@ this.consume();

if (char === '!') {
if (char === "!") {
this.state = 'markupDeclaration';
} else if (char === '/') {
} else if (char === "/") {
this.state = 'endTagOpen';

@@ -142,3 +142,3 @@ } else if (utils.isAlpha(char)) {

if (char === '-' && this.input.charAt(this.index) === '-') {
if (char === "-" && this.input.charAt(this.index) === "-") {
this.index++;

@@ -153,5 +153,5 @@ this.state = 'commentStart';

if (char === '-') {
if (char === "-") {
this.state = 'commentStartDash';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.finishComment();

@@ -168,9 +168,9 @@ this.state = 'beforeData';

if (char === '-') {
if (char === "-") {
this.state = 'commentEnd';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.finishComment();
this.state = 'beforeData';
} else {
this.delegate.appendToCommentData('-');
this.delegate.appendToCommentData("-");
this.state = 'comment';

@@ -183,3 +183,3 @@ }

if (char === '-') {
if (char === "-") {
this.state = 'commentEndDash';

@@ -194,6 +194,6 @@ } else {

if (char === '-') {
if (char === "-") {
this.state = 'commentEnd';
} else {
this.delegate.appendToCommentData('-' + char);
this.delegate.appendToCommentData("-" + char);
this.state = 'comment';

@@ -206,7 +206,7 @@ }

if (char === '>') {
if (char === ">") {
this.delegate.finishComment();
this.state = 'beforeData';
} else {
this.delegate.appendToCommentData('--' + char);
this.delegate.appendToCommentData("--" + char);
this.state = 'comment';

@@ -221,5 +221,5 @@ }

this.state = 'beforeAttributeName';
} else if (char === '/') {
} else if (char === "/") {
this.state = 'selfClosingStartTag';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.finishTag();

@@ -237,5 +237,5 @@ this.state = 'beforeData';

return;
} else if (char === '/') {
} else if (char === "/") {
this.state = 'selfClosingStartTag';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.finishTag();

@@ -255,7 +255,7 @@ this.state = 'beforeData';

this.state = 'afterAttributeName';
} else if (char === '/') {
} else if (char === "/") {
this.state = 'selfClosingStartTag';
} else if (char === '=') {
} else if (char === "=") {
this.state = 'beforeAttributeValue';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.beginAttributeValue(false);

@@ -275,7 +275,7 @@ this.delegate.finishAttributeValue();

return;
} else if (char === '/') {
} else if (char === "/") {
this.state = 'selfClosingStartTag';
} else if (char === '=') {
} else if (char === "=") {
this.state = 'beforeAttributeValue';
} else if (char === '>') {
} else if (char === ">") {
this.delegate.beginAttributeValue(false);

@@ -300,6 +300,6 @@ this.delegate.finishAttributeValue();

this.delegate.beginAttributeValue(true);
} else if (char === '\'') {
} else if (char === "'") {
this.state = 'attributeValueSingleQuoted';
this.delegate.beginAttributeValue(true);
} else if (char === '>') {
} else if (char === ">") {
this.delegate.beginAttributeValue(false);

@@ -322,4 +322,4 @@ this.delegate.finishAttributeValue();

this.state = 'afterAttributeValueQuoted';
} else if (char === '&') {
this.delegate.appendToAttributeValue(this.consumeCharRef('"') || '&');
} else if (char === "&") {
this.delegate.appendToAttributeValue(this.consumeCharRef('"') || "&");
} else {

@@ -333,7 +333,7 @@ this.delegate.appendToAttributeValue(char);

if (char === '\'') {
if (char === "'") {
this.delegate.finishAttributeValue();
this.state = 'afterAttributeValueQuoted';
} else if (char === '&') {
this.delegate.appendToAttributeValue(this.consumeCharRef('\'') || '&');
} else if (char === "&") {
this.delegate.appendToAttributeValue(this.consumeCharRef("'") || "&");
} else {

@@ -350,5 +350,5 @@ this.delegate.appendToAttributeValue(char);

this.state = 'beforeAttributeName';
} else if (char === '&') {
this.delegate.appendToAttributeValue(this.consumeCharRef('>') || '&');
} else if (char === '>') {
} else if (char === "&") {
this.delegate.appendToAttributeValue(this.consumeCharRef(">") || "&");
} else if (char === ">") {
this.delegate.finishAttributeValue();

@@ -368,6 +368,6 @@ this.delegate.finishTag();

this.state = 'beforeAttributeName';
} else if (char === '/') {
} else if (char === "/") {
this.consume();
this.state = 'selfClosingStartTag';
} else if (char === '>') {
} else if (char === ">") {
this.consume();

@@ -384,3 +384,3 @@ this.delegate.finishTag();

if (char === '>') {
if (char === ">") {
this.consume();

@@ -387,0 +387,0 @@ this.delegate.markTagAsSelfClosing();

@@ -10,3 +10,3 @@ 'use strict';

">": "&gt;",
"\"": "&quot;",
'"': "&quot;",
"'": "&#x27;",

@@ -32,3 +32,3 @@ "`": "&#x60;"

generate: function (tokens) {
var buffer = "";
var buffer = '';
var token;

@@ -35,0 +35,0 @@ for (var i = 0; i < tokens.length; i++) {

@@ -116,3 +116,3 @@ 'use strict';

beginAttribute: function () {
this._currentAttribute = ['', '', null];
this._currentAttribute = ["", "", null];
this.token.attributes.push(this._currentAttribute);

@@ -130,3 +130,3 @@ },

appendToAttributeValue: function (char) {
this._currentAttribute[1] = this._currentAttribute[1] || '';
this._currentAttribute[1] = this._currentAttribute[1] || "";
this._currentAttribute[1] += char;

@@ -133,0 +133,0 @@ },

@@ -22,3 +22,3 @@ 'use strict';

this.type = 'Chars';
this.chars = chars || '';
this.chars = chars || "";
}

@@ -25,0 +25,0 @@

@@ -8,7 +8,9 @@ 'use strict';

function isSpace(char) {
return /[\t\n\f ]/.test(char);
return (/[\t\n\f ]/.test(char)
);
}
function isAlpha(char) {
return /[A-Za-z]/.test(char);
return (/[A-Za-z]/.test(char)
);
}

@@ -15,0 +17,0 @@

@@ -230,3 +230,3 @@ import render from "./render";

if (handledMorphs[_key]) {
if (_key in handledMorphs) {
// In this branch we are dealing with a duplicate key. The strategy

@@ -233,0 +233,0 @@ // is to take the original key and append a counter to it that is

@@ -6,3 +6,3 @@ /*

* See https://raw.githubusercontent.com/tildeio/htmlbars/master/LICENSE
* @version 0.13.34.c418c83b
* @version v0.13.35
*/

@@ -9,0 +9,0 @@

@@ -59,3 +59,3 @@ define('dom-helper-tests/dom-helper-node-test', ['../dom-helper'], function (DOMHelper) {

var foreignNamespaces = ["foreignObject", "desc", "title"];
var foreignNamespaces = ['foreignObject', 'desc', 'title'];

@@ -71,3 +71,3 @@ var dom, i, foreignNamespace;

QUnit.module("DOM Helper", {
QUnit.module('DOM Helper', {
beforeEach: function () {

@@ -81,13 +81,13 @@ dom = new DOMHelper['default']();

test("#createElement", function () {
var node = dom.createElement("div");
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div></div>");
test('#createElement', function () {
var node = dom.createElement('div');
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div></div>');
});
test("#childAtIndex", function () {
var node = dom.createElement("div");
test('#childAtIndex', function () {
var node = dom.createElement('div');
var child1 = dom.createElement("p");
var child2 = dom.createElement("img");
var child1 = dom.createElement('p');
var child2 = dom.createElement('img');

@@ -99,3 +99,3 @@ strictEqual(dom.childAtIndex(node, 0), null);

dom.appendChild(node, child1);
strictEqual(dom.childAtIndex(node, 0).tagName, "P");
strictEqual(dom.childAtIndex(node, 0).tagName, 'P');
strictEqual(dom.childAtIndex(node, 1), null);

@@ -105,149 +105,149 @@ strictEqual(dom.childAtIndex(node, 2), null);

dom.insertBefore(node, child2, child1);
strictEqual(dom.childAtIndex(node, 0).tagName, "IMG");
strictEqual(dom.childAtIndex(node, 1).tagName, "P");
strictEqual(dom.childAtIndex(node, 0).tagName, 'IMG');
strictEqual(dom.childAtIndex(node, 1).tagName, 'P');
strictEqual(dom.childAtIndex(node, 2), null);
});
test("#appendText adds text", function () {
var node = dom.createElement("div");
var text = dom.appendText(node, "Howdy");
ok(!!text, "returns node");
htmlbars_test_helpers.equalHTML(node, "<div>Howdy</div>");
test('#appendText adds text', function () {
var node = dom.createElement('div');
var text = dom.appendText(node, 'Howdy');
ok(!!text, 'returns node');
htmlbars_test_helpers.equalHTML(node, '<div>Howdy</div>');
});
test("#setAttribute", function () {
var node = dom.createElement("div");
dom.setAttribute(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
dom.setAttribute(node, "id", null);
htmlbars_test_helpers.equalHTML(node, "<div id=\"null\"></div>");
test('#setAttribute', function () {
var node = dom.createElement('div');
dom.setAttribute(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
dom.setAttribute(node, 'id', null);
htmlbars_test_helpers.equalHTML(node, '<div id="null"></div>');
node = dom.createElement("input");
ok(node.getAttribute("disabled") === disabledAbsentValue, "precond: disabled is absent");
dom.setAttribute(node, "disabled", true);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled set to true is present");
dom.setAttribute(node, "disabled", false);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled set to false is present");
node = dom.createElement('input');
ok(node.getAttribute('disabled') === disabledAbsentValue, 'precond: disabled is absent');
dom.setAttribute(node, 'disabled', true);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled set to true is present');
dom.setAttribute(node, 'disabled', false);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled set to false is present');
});
test("#setAttributeNS", function () {
var node = dom.createElement("svg");
dom.setAttributeNS(node, xlinkNamespace, "xlink:href", "super-fun");
test('#setAttributeNS', function () {
var node = dom.createElement('svg');
dom.setAttributeNS(node, xlinkNamespace, 'xlink:href', 'super-fun');
// chrome adds (xmlns:xlink="http://www.w3.org/1999/xlink") property while others don't
// thus equalHTML is not useful
var el = document.createElement("div");
var el = document.createElement('div');
el.appendChild(node);
// phantomjs omits the prefix, thus we can't find xlink:
ok(el.innerHTML.indexOf("href=\"super-fun\"") > 0);
dom.setAttributeNS(node, xlinkNamespace, "href", null);
ok(el.innerHTML.indexOf('href="super-fun"') > 0);
dom.setAttributeNS(node, xlinkNamespace, 'href', null);
ok(el.innerHTML.indexOf("href=\"null\"") > 0);
ok(el.innerHTML.indexOf('href="null"') > 0);
});
test("#getElementById", function () {
var parentNode = dom.createElement("div"),
childNode = dom.createElement("div");
dom.setAttribute(parentNode, "id", "parent");
dom.setAttribute(childNode, "id", "child");
test('#getElementById', function () {
var parentNode = dom.createElement('div'),
childNode = dom.createElement('div');
dom.setAttribute(parentNode, 'id', 'parent');
dom.setAttribute(childNode, 'id', 'child');
dom.appendChild(parentNode, childNode);
dom.document.body.appendChild(parentNode);
htmlbars_test_helpers.equalHTML(dom.getElementById("child"), "<div id=\"child\"></div>");
htmlbars_test_helpers.equalHTML(dom.getElementById('child'), '<div id="child"></div>');
dom.document.body.removeChild(parentNode);
});
test("#setPropertyStrict", function () {
var node = dom.createElement("div");
dom.setPropertyStrict(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
test('#setPropertyStrict', function () {
var node = dom.createElement('div');
dom.setPropertyStrict(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
node = dom.createElement("input");
ok(node.getAttribute("disabled") === disabledAbsentValue, "precond: disabled is absent");
dom.setPropertyStrict(node, "disabled", true);
ok(node.getAttribute("disabled") !== disabledAbsentValue, "disabled is present");
dom.setPropertyStrict(node, "disabled", false);
ok(node.getAttribute("disabled") === disabledAbsentValue, "disabled has been removed");
node = dom.createElement('input');
ok(node.getAttribute('disabled') === disabledAbsentValue, 'precond: disabled is absent');
dom.setPropertyStrict(node, 'disabled', true);
ok(node.getAttribute('disabled') !== disabledAbsentValue, 'disabled is present');
dom.setPropertyStrict(node, 'disabled', false);
ok(node.getAttribute('disabled') === disabledAbsentValue, 'disabled has been removed');
});
// IE dislikes undefined or null for value
test("#setPropertyStrict value", function () {
var node = dom.createElement("input");
dom.setPropertyStrict(node, "value", undefined);
equal(node.value, "", "blank string is set for undefined");
dom.setPropertyStrict(node, "value", null);
equal(node.value, "", "blank string is set for undefined");
test('#setPropertyStrict value', function () {
var node = dom.createElement('input');
dom.setPropertyStrict(node, 'value', undefined);
equal(node.value, '', 'blank string is set for undefined');
dom.setPropertyStrict(node, 'value', null);
equal(node.value, '', 'blank string is set for undefined');
});
// IE dislikes undefined or null for type
test("#setPropertyStrict type", function () {
var node = dom.createElement("input");
dom.setPropertyStrict(node, "type", undefined);
equal(node.type, "text", "text default is set for undefined");
dom.setPropertyStrict(node, "type", null);
equal(node.type, "text", "text default is set for undefined");
test('#setPropertyStrict type', function () {
var node = dom.createElement('input');
dom.setPropertyStrict(node, 'type', undefined);
equal(node.type, 'text', 'text default is set for undefined');
dom.setPropertyStrict(node, 'type', null);
equal(node.type, 'text', 'text default is set for undefined');
});
// setting undefined or null to src makes a network request
test("#setPropertyStrict src", function () {
var node = dom.createElement("img");
dom.setPropertyStrict(node, "src", undefined);
notEqual(node.src, undefined, "blank string is set for undefined");
dom.setPropertyStrict(node, "src", null);
notEqual(node.src, null, "blank string is set for undefined");
test('#setPropertyStrict src', function () {
var node = dom.createElement('img');
dom.setPropertyStrict(node, 'src', undefined);
notEqual(node.src, undefined, 'blank string is set for undefined');
dom.setPropertyStrict(node, 'src', null);
notEqual(node.src, null, 'blank string is set for undefined');
});
test("#removeAttribute", function () {
var node = dom.createElement("div");
dom.setAttribute(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>", "precond - attribute exists");
test('#removeAttribute', function () {
var node = dom.createElement('div');
dom.setAttribute(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>', 'precond - attribute exists');
dom.removeAttribute(node, "id");
htmlbars_test_helpers.equalHTML(node, "<div></div>", "attribute was removed");
dom.removeAttribute(node, 'id');
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'attribute was removed');
});
test("#removeAttribute of SVG", function () {
test('#removeAttribute of SVG', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("svg");
dom.setAttribute(node, "viewBox", "0 0 100 100");
htmlbars_test_helpers.equalHTML(node, "<svg viewBox=\"0 0 100 100\"></svg>", "precond - attribute exists");
var node = dom.createElement('svg');
dom.setAttribute(node, 'viewBox', '0 0 100 100');
htmlbars_test_helpers.equalHTML(node, '<svg viewBox="0 0 100 100"></svg>', 'precond - attribute exists');
dom.removeAttribute(node, "viewBox");
htmlbars_test_helpers.equalHTML(node, "<svg></svg>", "attribute was removed");
dom.removeAttribute(node, 'viewBox');
htmlbars_test_helpers.equalHTML(node, '<svg></svg>', 'attribute was removed');
});
test("#setProperty", function () {
var node = dom.createElement("div");
dom.setProperty(node, "id", "super-tag");
htmlbars_test_helpers.equalHTML(node, "<div id=\"super-tag\"></div>");
dom.setProperty(node, "id", null);
ok(node.getAttribute("id") !== "super-tag", "null property sets to the property");
test('#setProperty', function () {
var node = dom.createElement('div');
dom.setProperty(node, 'id', 'super-tag');
htmlbars_test_helpers.equalHTML(node, '<div id="super-tag"></div>');
dom.setProperty(node, 'id', null);
ok(node.getAttribute('id') !== 'super-tag', 'null property sets to the property');
node = dom.createElement("div");
dom.setProperty(node, "data-fun", "whoopie");
htmlbars_test_helpers.equalHTML(node, "<div data-fun=\"whoopie\"></div>");
dom.setProperty(node, "data-fun", null);
htmlbars_test_helpers.equalHTML(node, "<div></div>", "null attribute removes the attribute");
node = dom.createElement('div');
dom.setProperty(node, 'data-fun', 'whoopie');
htmlbars_test_helpers.equalHTML(node, '<div data-fun="whoopie"></div>');
dom.setProperty(node, 'data-fun', null);
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'null attribute removes the attribute');
node = dom.createElement("input");
dom.setProperty(node, "disabled", true);
node = dom.createElement('input');
dom.setProperty(node, 'disabled', true);
equal(node.disabled, true);
dom.setProperty(node, "disabled", false);
dom.setProperty(node, 'disabled', false);
equal(node.disabled, false);
node = dom.createElement("div");
dom.setProperty(node, "style", "color: red;");
htmlbars_test_helpers.equalHTML(node, "<div style=\"color: red;\"></div>");
node = dom.createElement('div');
dom.setProperty(node, 'style', 'color: red;');
htmlbars_test_helpers.equalHTML(node, '<div style="color: red;"></div>');
});
test("#setProperty removes attr with undefined", function () {
var node = dom.createElement("div");
dom.setProperty(node, "data-fun", "whoopie");
htmlbars_test_helpers.equalHTML(node, "<div data-fun=\"whoopie\"></div>");
dom.setProperty(node, "data-fun", undefined);
htmlbars_test_helpers.equalHTML(node, "<div></div>", "undefined attribute removes the attribute");
test('#setProperty removes attr with undefined', function () {
var node = dom.createElement('div');
dom.setProperty(node, 'data-fun', 'whoopie');
htmlbars_test_helpers.equalHTML(node, '<div data-fun="whoopie"></div>');
dom.setProperty(node, 'data-fun', undefined);
htmlbars_test_helpers.equalHTML(node, '<div></div>', 'undefined attribute removes the attribute');
});
test("#setProperty uses setAttribute for special non-compliant element props", function () {
test('#setProperty uses setAttribute for special non-compliant element props', function () {
expect(6);
var badPairs = [{ tagName: "button", key: "type", value: "submit", selfClosing: false }, { tagName: "input", key: "type", value: "x-not-supported", selfClosing: true }];
var badPairs = [{ tagName: 'button', key: 'type', value: 'submit', selfClosing: false }, { tagName: 'input', key: 'type', value: 'x-not-supported', selfClosing: true }];

@@ -259,4 +259,4 @@ badPairs.forEach(function (pair) {

node.setAttribute = function (attrName, value) {
equal(attrName, pair.key, "setAttribute called with correct attrName");
equal(value, pair.value, "setAttribute called with correct value");
equal(attrName, pair.key, 'setAttribute called with correct attrName');
equal(value, pair.value, 'setAttribute called with correct value');
return setAttribute.call(this, attrName, value);

@@ -268,49 +268,49 @@ };

// e.g. <button type="submit"></button>
var expected = "<" + pair.tagName + " " + pair.key + "=\"" + pair.value + "\">";
var expected = '<' + pair.tagName + ' ' + pair.key + '="' + pair.value + '">';
if (pair.selfClosing === false) {
expected += "</" + pair.tagName + ">";
expected += '</' + pair.tagName + '>';
}
htmlbars_test_helpers.equalHTML(node, expected, "output html is correct");
htmlbars_test_helpers.equalHTML(node, expected, 'output html is correct');
});
});
test("#addClasses", function () {
var node = dom.createElement("div");
dom.addClasses(node, ["super-fun"]);
equal(node.className, "super-fun");
dom.addClasses(node, ["super-fun"]);
equal(node.className, "super-fun");
dom.addClasses(node, ["super-blast"]);
equal(node.className, "super-fun super-blast");
dom.addClasses(node, ["bacon", "ham"]);
equal(node.className, "super-fun super-blast bacon ham");
test('#addClasses', function () {
var node = dom.createElement('div');
dom.addClasses(node, ['super-fun']);
equal(node.className, 'super-fun');
dom.addClasses(node, ['super-fun']);
equal(node.className, 'super-fun');
dom.addClasses(node, ['super-blast']);
equal(node.className, 'super-fun super-blast');
dom.addClasses(node, ['bacon', 'ham']);
equal(node.className, 'super-fun super-blast bacon ham');
});
test("#removeClasses", function () {
var node = dom.createElement("div");
node.setAttribute("class", "this-class that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.className, "that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.className, "that-class");
dom.removeClasses(node, ["that-class"]);
equal(node.className, "");
node.setAttribute("class", "woop moop jeep");
dom.removeClasses(node, ["moop", "jeep"]);
equal(node.className, "woop");
test('#removeClasses', function () {
var node = dom.createElement('div');
node.setAttribute('class', 'this-class that-class');
dom.removeClasses(node, ['this-class']);
equal(node.className, 'that-class');
dom.removeClasses(node, ['this-class']);
equal(node.className, 'that-class');
dom.removeClasses(node, ['that-class']);
equal(node.className, '');
node.setAttribute('class', 'woop moop jeep');
dom.removeClasses(node, ['moop', 'jeep']);
equal(node.className, 'woop');
});
test("#createElement of tr with contextual table element", function () {
var tableElement = document.createElement("table"),
node = dom.createElement("tr", tableElement);
equal(node.tagName, "TR");
htmlbars_test_helpers.equalHTML(node, "<tr></tr>");
test('#createElement of tr with contextual table element', function () {
var tableElement = document.createElement('table'),
node = dom.createElement('tr', tableElement);
equal(node.tagName, 'TR');
htmlbars_test_helpers.equalHTML(node, '<tr></tr>');
});
test("#createMorph has optional contextualElement", function () {
var parent = document.createElement("div"),
test('#createMorph has optional contextualElement', function () {
var parent = document.createElement('div'),
fragment = document.createDocumentFragment(),
start = document.createTextNode(""),
end = document.createTextNode(""),
start = document.createTextNode(''),
end = document.createTextNode(''),
morph,

@@ -324,3 +324,3 @@ thrown;

}
ok(thrown, "Exception thrown when a fragment is provided for contextualElement");
ok(thrown, 'Exception thrown when a fragment is provided for contextualElement');

@@ -334,33 +334,33 @@ morph = dom.createMorph(fragment, start, end, parent);

test("#appendMorph", function () {
var element = document.createElement("div");
test('#appendMorph', function () {
var element = document.createElement('div');
dom.appendText(element, "a");
dom.appendText(element, 'a');
var morph = dom.appendMorph(element);
dom.appendText(element, "c");
dom.appendText(element, 'c');
morph.setContent("b");
morph.setContent('b');
equal(element.innerHTML, "abc");
equal(element.innerHTML, 'abc');
});
test("#insertMorphBefore", function () {
var element = document.createElement("div");
test('#insertMorphBefore', function () {
var element = document.createElement('div');
dom.appendText(element, "a");
var c = dom.appendText(element, "c");
dom.appendText(element, 'a');
var c = dom.appendText(element, 'c');
var morph = dom.insertMorphBefore(element, c);
morph.setContent("b");
morph.setContent('b');
equal(element.innerHTML, "abc");
equal(element.innerHTML, 'abc');
});
test("#parseHTML combinations", function () {
test('#parseHTML combinations', function () {
var parsingCombinations = [
// omitted start tags
//
["table", "<tr><td>Yo</td></tr>", "TR"], ["table", "<tbody><tr></tr></tbody>", "TBODY"], ["table", "<col></col>", "COL"],
['table', '<tr><td>Yo</td></tr>', 'TR'], ['table', '<tbody><tr></tr></tbody>', 'TBODY'], ['table', '<col></col>', 'COL'],
// elements with broken innerHTML in IE9 and down
["select", "<option></option>", "OPTION"], ["colgroup", "<col></col>", "COL"], ["tbody", "<tr></tr>", "TR"], ["tfoot", "<tr></tr>", "TR"], ["thead", "<tr></tr>", "TR"], ["tr", "<td></td>", "TD"], ["div", "<script></script>", "SCRIPT"]];
['select', '<option></option>', 'OPTION'], ['colgroup', '<col></col>', 'COL'], ['tbody', '<tr></tr>', 'TR'], ['tfoot', '<tr></tr>', 'TR'], ['thead', '<tr></tr>', 'TR'], ['tr', '<td></td>', 'TD'], ['div', '<script></script>', 'SCRIPT']];

@@ -375,93 +375,93 @@ var contextTag, content, expectedTagName, contextElement, nodes;

nodes = dom.parseHTML(content, contextElement).childNodes;
equal(nodes[0].tagName, expectedTagName, "#parseHTML of " + content + " returns a " + expectedTagName + " inside a " + contextTag + " context");
equal(nodes[0].tagName, expectedTagName, '#parseHTML of ' + content + ' returns a ' + expectedTagName + ' inside a ' + contextTag + ' context');
}
});
test("#parseHTML of script then tr inside table context wraps the tr in a tbody", function () {
var tableElement = document.createElement("table"),
nodes = dom.parseHTML("<script></script><tr><td>Yo</td></tr>", tableElement).childNodes;
test('#parseHTML of script then tr inside table context wraps the tr in a tbody', function () {
var tableElement = document.createElement('table'),
nodes = dom.parseHTML('<script></script><tr><td>Yo</td></tr>', tableElement).childNodes;
// The HTML spec suggests the first item must be the child of
// the omittable start tag. Here script is the first child, so no-go.
equal(nodes.length, 2, "Leading script tag corrupts");
equal(nodes[0].tagName, "SCRIPT");
equal(nodes[1].tagName, "TBODY");
equal(nodes.length, 2, 'Leading script tag corrupts');
equal(nodes[0].tagName, 'SCRIPT');
equal(nodes[1].tagName, 'TBODY');
});
test("#parseHTML of select allows the initial implicit option selection to remain", function () {
var div = document.createElement("div");
var select = dom.parseHTML("<select><option></option></select>", div).childNodes[0];
test('#parseHTML of select allows the initial implicit option selection to remain', function () {
var div = document.createElement('div');
var select = dom.parseHTML('<select><option></option></select>', div).childNodes[0];
ok(select.childNodes[0].selected, "first element is selected");
ok(select.childNodes[0].selected, 'first element is selected');
});
test("#parseHTML of options removes an implicit selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\"></option><option value=\"2\"></option>", select).childNodes;
test('#parseHTML of options removes an implicit selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1"></option><option value="2"></option>', select).childNodes;
ok(!options[0].selected, "first element is not selected");
ok(!options[1].selected, "second element is not selected");
ok(!options[0].selected, 'first element is not selected');
ok(!options[1].selected, 'second element is not selected');
});
test("#parseHTML of options leaves an explicit first selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\" selected></option><option value=\"2\"></option>", select).childNodes;
test('#parseHTML of options leaves an explicit first selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1" selected></option><option value="2"></option>', select).childNodes;
ok(options[0].selected, "first element is selected");
ok(!options[1].selected, "second element is not selected");
ok(options[0].selected, 'first element is selected');
ok(!options[1].selected, 'second element is not selected');
});
test("#parseHTML of options leaves an explicit second selection", function () {
var select = document.createElement("select");
var options = dom.parseHTML("<option value=\"1\"></option><option value=\"2\" selected=\"selected\"></option>", select).childNodes;
test('#parseHTML of options leaves an explicit second selection', function () {
var select = document.createElement('select');
var options = dom.parseHTML('<option value="1"></option><option value="2" selected="selected"></option>', select).childNodes;
ok(!options[0].selected, "first element is not selected");
ok(options[1].selected, "second element is selected");
ok(!options[0].selected, 'first element is not selected');
ok(options[1].selected, 'second element is selected');
});
test("#parseHTML of script then tr inside tbody context", function () {
var tbodyElement = document.createElement("tbody"),
nodes = dom.parseHTML("<script></script><tr><td>Yo</td></tr>", tbodyElement).childNodes;
equal(nodes.length, 2, "Leading script tag corrupts");
equal(nodes[0].tagName, "SCRIPT");
equal(nodes[1].tagName, "TR");
test('#parseHTML of script then tr inside tbody context', function () {
var tbodyElement = document.createElement('tbody'),
nodes = dom.parseHTML('<script></script><tr><td>Yo</td></tr>', tbodyElement).childNodes;
equal(nodes.length, 2, 'Leading script tag corrupts');
equal(nodes[0].tagName, 'SCRIPT');
equal(nodes[1].tagName, 'TR');
});
test("#parseHTML with retains whitespace", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("leading<script id=\"first\"></script> <script id=\"second\"></script><div><script></script> <script></script>, indeed.</div>", div).childNodes;
equal(nodes[0].data, "leading");
equal(nodes[1].tagName, "SCRIPT");
equal(nodes[2].data, " ");
equal(nodes[3].tagName, "SCRIPT");
equal(nodes[4].tagName, "DIV");
equal(nodes[4].childNodes[0].tagName, "SCRIPT");
equal(nodes[4].childNodes[1].data, " ");
equal(nodes[4].childNodes[2].tagName, "SCRIPT");
equal(nodes[4].childNodes[3].data, ", indeed.");
test('#parseHTML with retains whitespace', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('leading<script id="first"></script> <script id="second"></script><div><script></script> <script></script>, indeed.</div>', div).childNodes;
equal(nodes[0].data, 'leading');
equal(nodes[1].tagName, 'SCRIPT');
equal(nodes[2].data, ' ');
equal(nodes[3].tagName, 'SCRIPT');
equal(nodes[4].tagName, 'DIV');
equal(nodes[4].childNodes[0].tagName, 'SCRIPT');
equal(nodes[4].childNodes[1].data, ' ');
equal(nodes[4].childNodes[2].tagName, 'SCRIPT');
equal(nodes[4].childNodes[3].data, ', indeed.');
});
test("#parseHTML with retains whitespace of top element", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("<span>hello <script id=\"first\"></script> yeah</span>", div).childNodes;
equal(nodes[0].tagName, "SPAN");
htmlbars_test_helpers.equalHTML(nodes, "<span>hello <script id=\"first\"></script> yeah</span>");
test('#parseHTML with retains whitespace of top element', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('<span>hello <script id="first"></script> yeah</span>', div).childNodes;
equal(nodes[0].tagName, 'SPAN');
htmlbars_test_helpers.equalHTML(nodes, '<span>hello <script id="first"></script> yeah</span>');
});
test("#parseHTML with retains whitespace after script", function () {
var div = document.createElement("div");
var nodes = dom.parseHTML("<span>hello</span><script id=\"first\"></script><span><script></script> kwoop</span>", div).childNodes;
equal(nodes[0].tagName, "SPAN");
equal(nodes[1].tagName, "SCRIPT");
equal(nodes[2].tagName, "SPAN");
htmlbars_test_helpers.equalHTML(nodes, "<span>hello</span><script id=\"first\"></script><span><script></script> kwoop</span>");
test('#parseHTML with retains whitespace after script', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML('<span>hello</span><script id="first"></script><span><script></script> kwoop</span>', div).childNodes;
equal(nodes[0].tagName, 'SPAN');
equal(nodes[1].tagName, 'SCRIPT');
equal(nodes[2].tagName, 'SPAN');
htmlbars_test_helpers.equalHTML(nodes, '<span>hello</span><script id="first"></script><span><script></script> kwoop</span>');
});
test("#parseHTML of number", function () {
var div = document.createElement("div");
test('#parseHTML of number', function () {
var div = document.createElement('div');
var nodes = dom.parseHTML(5, div).childNodes;
equal(nodes[0].data, "5");
htmlbars_test_helpers.equalHTML(nodes, "5");
equal(nodes[0].data, '5');
htmlbars_test_helpers.equalHTML(nodes, '5');
});
test("#protocolForURL", function () {
test('#protocolForURL', function () {
var protocol = dom.protocolForURL("http://www.emberjs.com");

@@ -476,28 +476,28 @@ equal(protocol, "http:");

test("#cloneNode shallow", function () {
var divElement = document.createElement("div");
test('#cloneNode shallow', function () {
var divElement = document.createElement('div');
divElement.appendChild(document.createElement("span"));
divElement.appendChild(document.createElement('span'));
var node = dom.cloneNode(divElement, false);
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div></div>");
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div></div>');
});
test("#cloneNode deep", function () {
var divElement = document.createElement("div");
test('#cloneNode deep', function () {
var divElement = document.createElement('div');
divElement.appendChild(document.createElement("span"));
divElement.appendChild(document.createElement('span'));
var node = dom.cloneNode(divElement, true);
equal(node.tagName, "DIV");
htmlbars_test_helpers.equalHTML(node, "<div><span></span></div>");
equal(node.tagName, 'DIV');
htmlbars_test_helpers.equalHTML(node, '<div><span></span></div>');
});
test("dom node has empty text after cloning and ensuringBlankTextNode", function () {
var div = document.createElement("div");
test('dom node has empty text after cloning and ensuringBlankTextNode', function () {
var div = document.createElement('div');
div.appendChild(document.createTextNode(""));
div.appendChild(document.createTextNode(''));

@@ -507,3 +507,3 @@ var clonedDiv = dom.cloneNode(div, true);

equal(clonedDiv.nodeType, 1);
htmlbars_test_helpers.equalHTML(clonedDiv, "<div></div>");
htmlbars_test_helpers.equalHTML(clonedDiv, '<div></div>');
// IE's native cloneNode drops blank string text

@@ -517,7 +517,7 @@ // nodes. Assert repairClonedNode brings back the blank

test("dom node has empty start text after cloning and ensuringBlankTextNode", function () {
var div = document.createElement("div");
test('dom node has empty start text after cloning and ensuringBlankTextNode', function () {
var div = document.createElement('div');
div.appendChild(document.createTextNode(""));
div.appendChild(document.createElement("span"));
div.appendChild(document.createTextNode(''));
div.appendChild(document.createElement('span'));

@@ -527,3 +527,3 @@ var clonedDiv = dom.cloneNode(div, true);

equal(clonedDiv.nodeType, 1);
htmlbars_test_helpers.equalHTML(clonedDiv, "<div><span></span></div>");
htmlbars_test_helpers.equalHTML(clonedDiv, '<div><span></span></div>');
// IE's native cloneNode drops blank string text

@@ -537,7 +537,7 @@ // nodes. Assert denormalizeText brings back the blank

test("dom node checked after cloning and ensuringChecked", function () {
var input = document.createElement("input");
test('dom node checked after cloning and ensuringChecked', function () {
var input = document.createElement('input');
input.setAttribute("checked", "checked");
ok(input.checked, "input is checked");
input.setAttribute('checked', 'checked');
ok(input.checked, 'input is checked');

@@ -550,9 +550,9 @@ var clone = dom.cloneNode(input, false);

htmlbars_test_helpers.isCheckedInputHTML(clone, "<input checked=\"checked\">");
ok(clone.checked, "clone is checked");
htmlbars_test_helpers.isCheckedInputHTML(clone, '<input checked="checked">');
ok(clone.checked, 'clone is checked');
});
if ("namespaceURI" in document.createElement("div")) {
if ('namespaceURI' in document.createElement('div')) {
QUnit.module("DOM Helper namespaces", {
QUnit.module('DOM Helper namespaces', {
beforeEach: function () {

@@ -566,65 +566,65 @@ dom = new DOMHelper['default']();

test("#createElement div is xhtml", function () {
var node = dom.createElement("div");
test('#createElement div is xhtml', function () {
var node = dom.createElement('div');
equal(node.namespaceURI, xhtmlNamespace);
});
test("#createElement of svg with svg namespace", function () {
test('#createElement of svg with svg namespace', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("svg");
equal(node.tagName, "svg");
var node = dom.createElement('svg');
equal(node.tagName, 'svg');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of path with detected svg contextual element", function () {
test('#createElement of path with detected svg contextual element', function () {
dom.setNamespace(svgNamespace);
var node = dom.createElement("path");
equal(node.tagName, "path");
var node = dom.createElement('path');
equal(node.tagName, 'path');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of path with svg contextual element", function () {
var node = dom.createElement("path", document.createElementNS(svgNamespace, "svg"));
equal(node.tagName, "path");
test('#createElement of path with svg contextual element', function () {
var node = dom.createElement('path', document.createElementNS(svgNamespace, 'svg'));
equal(node.tagName, 'path');
equal(node.namespaceURI, svgNamespace);
});
test("#createElement of svg with div namespace", function () {
var node = dom.createElement("svg", document.createElement("div"));
equal(node.tagName, "svg");
test('#createElement of svg with div namespace', function () {
var node = dom.createElement('svg', document.createElement('div'));
equal(node.tagName, 'svg');
equal(node.namespaceURI, svgNamespace);
});
test("#getElementById with different root node", function () {
var doc = document.implementation.createDocument(xhtmlNamespace, "html", null),
body = document.createElementNS(xhtmlNamespace, "body"),
parentNode = dom.createElement("div"),
childNode = dom.createElement("div");
test('#getElementById with different root node', function () {
var doc = document.implementation.createDocument(xhtmlNamespace, 'html', null),
body = document.createElementNS(xhtmlNamespace, 'body'),
parentNode = dom.createElement('div'),
childNode = dom.createElement('div');
doc.documentElement.appendChild(body);
dom.setAttribute(parentNode, "id", "parent");
dom.setAttribute(childNode, "id", "child");
dom.setAttribute(parentNode, 'id', 'parent');
dom.setAttribute(childNode, 'id', 'child');
dom.appendChild(parentNode, childNode);
dom.appendChild(body, parentNode);
htmlbars_test_helpers.equalHTML(dom.getElementById("child", doc), "<div id=\"child\"></div>");
htmlbars_test_helpers.equalHTML(dom.getElementById('child', doc), '<div id="child"></div>');
});
test("#setProperty with namespaced attributes", function () {
test('#setProperty with namespaced attributes', function () {
var node;
dom.setNamespace(svgNamespace);
node = dom.createElement("svg");
dom.setProperty(node, "viewBox", "0 0 0 0");
htmlbars_test_helpers.equalHTML(node, "<svg viewBox=\"0 0 0 0\"></svg>");
node = dom.createElement('svg');
dom.setProperty(node, 'viewBox', '0 0 0 0');
htmlbars_test_helpers.equalHTML(node, '<svg viewBox="0 0 0 0"></svg>');
dom.setProperty(node, "xlink:title", "super-blast", xlinkNamespace);
dom.setProperty(node, 'xlink:title', 'super-blast', xlinkNamespace);
// chrome adds (xmlns:xlink="http://www.w3.org/1999/xlink") property while others don't
// thus equalHTML is not useful
var el = document.createElement("div");
var el = document.createElement('div');
el.appendChild(node);
// phantom js omits the prefix so we can't look for xlink:
ok(el.innerHTML.indexOf("title=\"super-blast\"") > 0);
ok(el.innerHTML.indexOf('title="super-blast"') > 0);
dom.setProperty(node, "xlink:title", null, xlinkNamespace);
equal(node.getAttribute("xlink:title"), null, "ns attr is removed");
dom.setProperty(node, 'xlink:title', null, xlinkNamespace);
equal(node.getAttribute('xlink:title'), null, 'ns attr is removed');
});

@@ -635,6 +635,6 @@

node = dom.createElement("svg");
dom.setProperty(node, "xlink:title", "Great Title", xlinkNamespace);
dom.setProperty(node, "xlink:title", undefined, xlinkNamespace);
equal(node.getAttribute("xlink:title"), undefined, "ns attr is removed");
node = dom.createElement('svg');
dom.setProperty(node, 'xlink:title', 'Great Title', xlinkNamespace);
dom.setProperty(node, 'xlink:title', undefined, xlinkNamespace);
equal(node.getAttribute('xlink:title'), undefined, 'ns attr is removed');
});

@@ -645,13 +645,13 @@

test("#createElement of div with " + foreignNamespace + " contextual element", function () {
var node = dom.createElement("div", document.createElementNS(svgNamespace, foreignNamespace));
equal(node.tagName, "DIV");
test('#createElement of div with ' + foreignNamespace + ' contextual element', function () {
var node = dom.createElement('div', document.createElementNS(svgNamespace, foreignNamespace));
equal(node.tagName, 'DIV');
equal(node.namespaceURI, xhtmlNamespace);
}); // jshint ignore:line
test("#parseHTML of div with " + foreignNamespace, function () {
test('#parseHTML of div with ' + foreignNamespace, function () {
dom.setNamespace(xhtmlNamespace);
var foreignObject = document.createElementNS(svgNamespace, foreignNamespace),
nodes = dom.parseHTML("<div></div>", foreignObject).childNodes;
equal(nodes[0].tagName, "DIV");
nodes = dom.parseHTML('<div></div>', foreignObject).childNodes;
equal(nodes[0].tagName, 'DIV');
equal(nodes[0].namespaceURI, xhtmlNamespace);

@@ -661,37 +661,37 @@ }); // jshint ignore:line

test("#parseHTML of path with svg contextual element", function () {
test('#parseHTML of path with svg contextual element', function () {
dom.setNamespace(svgNamespace);
var svgElement = document.createElementNS(svgNamespace, "svg"),
nodes = dom.parseHTML("<path></path>", svgElement).childNodes;
equal(nodes[0].tagName, "path");
var svgElement = document.createElementNS(svgNamespace, 'svg'),
nodes = dom.parseHTML('<path></path>', svgElement).childNodes;
equal(nodes[0].tagName, 'path');
equal(nodes[0].namespaceURI, svgNamespace);
});
test("#parseHTML of stop with linearGradient contextual element", function () {
test('#parseHTML of stop with linearGradient contextual element', function () {
dom.setNamespace(svgNamespace);
var svgElement = document.createElementNS(svgNamespace, "linearGradient"),
nodes = dom.parseHTML("<stop />", svgElement).childNodes;
equal(nodes[0].tagName, "stop");
var svgElement = document.createElementNS(svgNamespace, 'linearGradient'),
nodes = dom.parseHTML('<stop />', svgElement).childNodes;
equal(nodes[0].tagName, 'stop');
equal(nodes[0].namespaceURI, svgNamespace);
});
test("#addClasses on SVG", function () {
var node = document.createElementNS(svgNamespace, "svg");
dom.addClasses(node, ["super-fun"]);
equal(node.getAttribute("class"), "super-fun");
dom.addClasses(node, ["super-fun"]);
equal(node.getAttribute("class"), "super-fun");
dom.addClasses(node, ["super-blast"]);
equal(node.getAttribute("class"), "super-fun super-blast");
test('#addClasses on SVG', function () {
var node = document.createElementNS(svgNamespace, 'svg');
dom.addClasses(node, ['super-fun']);
equal(node.getAttribute('class'), 'super-fun');
dom.addClasses(node, ['super-fun']);
equal(node.getAttribute('class'), 'super-fun');
dom.addClasses(node, ['super-blast']);
equal(node.getAttribute('class'), 'super-fun super-blast');
});
test("#removeClasses on SVG", function () {
var node = document.createElementNS(svgNamespace, "svg");
node.setAttribute("class", "this-class that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.getAttribute("class"), "that-class");
dom.removeClasses(node, ["this-class"]);
equal(node.getAttribute("class"), "that-class");
dom.removeClasses(node, ["that-class"]);
equal(node.getAttribute("class"), "");
test('#removeClasses on SVG', function () {
var node = document.createElementNS(svgNamespace, 'svg');
node.setAttribute('class', 'this-class that-class');
dom.removeClasses(node, ['this-class']);
equal(node.getAttribute('class'), 'that-class');
dom.removeClasses(node, ['this-class']);
equal(node.getAttribute('class'), 'that-class');
dom.removeClasses(node, ['that-class']);
equal(node.getAttribute('class'), '');
});

@@ -920,3 +920,3 @@ }

var div = document.createElement("div");
if (typeof fragmentOrHtml === "string") {
if (typeof fragmentOrHtml === 'string') {
div.innerHTML = fragmentOrHtml;

@@ -929,2 +929,3 @@ } else {

}
function equalTokens(fragment, html, message) {

@@ -942,3 +943,3 @@ if (fragment.fragment) {

function normalizeTokens(token) {
if (token.type === "StartTag") {
if (token.type === 'StartTag') {
token.attributes = token.attributes.sort(function (a, b) {

@@ -973,8 +974,9 @@ if (a[0] > b[0]) {

}
var div = document.createElement("div");
var node = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var div = document.createElement('div');
var node = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
div.appendChild(node);
var clone = div.cloneNode(true);
return clone.innerHTML === "<svg xmlns=\"http://www.w3.org/2000/svg\" />";
return clone.innerHTML === '<svg xmlns="http://www.w3.org/2000/svg" />';
})();
function normalizeInnerHTML(actualHTML) {

@@ -984,6 +986,6 @@ if (ieSVGInnerHTML) {

// drop namespace attribute
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, "");
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, '');
// replace self-closing elements
actualHTML = actualHTML.replace(/<([^ >]+) [^\/>]*\/>/gi, function (tag, tagName) {
return tag.slice(0, tag.length - 3) + "></" + tagName + ">";
return tag.slice(0, tag.length - 3) + '></' + tagName + '>';
});

@@ -996,5 +998,6 @@ }

// detect weird IE8 checked element string
var checkedInput = document.createElement("input");
checkedInput.setAttribute("checked", "checked");
var checkedInput = document.createElement('input');
checkedInput.setAttribute('checked', 'checked');
var checkedInputString = checkedInput.outerHTML;
function isCheckedInputHTML(element) {

@@ -1005,3 +1008,4 @@ equal(element.outerHTML, checkedInputString);

// check which property has the node's text content
var textProperty = document.createElement("div").textContent === undefined ? "innerText" : "textContent";
var textProperty = document.createElement('div').textContent === undefined ? 'innerText' : 'textContent';
function getTextContent(el) {

@@ -1165,3 +1169,3 @@ // textNode

'"': '&quot;',
'\'': '&#x27;',
"'": '&#x27;',
'`': '&#x60;'

@@ -1176,2 +1180,3 @@ };

}
function extend(obj /* , ...source */) {

@@ -1386,2 +1391,3 @@ for (var i = 1; i < arguments.length; i++) {

};
function getAttrNamespace(attrName) {

@@ -1480,3 +1486,3 @@ var namespace;

str = str.replace(/\\/g, "\\\\");
str = str.replace(/"/g, "\\\"");
str = str.replace(/"/g, '\\"');
str = str.replace(/\n/g, "\\n");

@@ -1487,3 +1493,3 @@ return str;

function string(str) {
return "\"" + escapeString(str) + "\"";
return '"' + escapeString(str) + '"';
}

@@ -1607,3 +1613,3 @@

}
if (typeof blocks === "function") {
if (typeof blocks === 'function') {
env.hooks.bindBlock(env, shadowScope, blocks);

@@ -1618,2 +1624,3 @@ } else {

}
function renderAndCleanup(morph, env, options, shadowOptions, callback) {

@@ -1620,0 +1627,0 @@ // The RenderState object is used to collect information about what the

@@ -1,15 +0,14 @@

/* global QUnit */
/* global QUnit, after */
window.global_test_results = null;
var exportTestResultsForSauce = function(testResults) {
window.global_test_results = testResults;
};
if (typeof QUnit !== 'undefined') {
QUnit.done(exportTestResultsForSauce);
window.exportTestResultsForSauce = function (testResults) {
window.global_test_results = testResults;
};
QUnit.done(window.exportTestResultsForSauce);
} else if (typeof Mocha !== 'undefined') {
// Mocha stats reporting requires access to the mocha runner
// Issue: https://github.com/switchfly/ember-cli-mocha/issues/52
// after(exportTestResultsForSauce);
delete window.global_test_results;
after(function() {
window.global_test_results = window.mochaRunner.stats;
window.global_test_results.reports = [];
});
}

@@ -32,17 +32,17 @@ define('htmlbars-runtime-tests/hooks-test', ['../htmlbars-runtime', '../htmlbars-util/object-utils', '../htmlbars-compiler/compiler', '../htmlbars-test-helpers', '../dom-helper'], function (htmlbars_runtime, object_utils, compiler, htmlbars_test_helpers, DOMHelper) {

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});

@@ -52,17 +52,17 @@

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});

@@ -112,21 +112,21 @@

registerHelper("get", function (params) {
registerHelper('get', function (params) {
return params[0];
});
var object = { val: "hello" };
var template = compiler.compile("<div>{{get val}}</div>");
var object = { val: 'hello' };
var template = compiler.compile('<div>{{get val}}</div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div>hello</div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div>hello</div>');
object.val = "";
object.val = '';
result.rerender();
htmlbars_test_helpers.equalTokens(result.fragment, "<div></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div></div>');
});
test("subexr hook correctly handles false-like values", function () {
registerHelper("if", function (params) {
registerHelper('if', function (params) {
return params[0] ? params[1] : params[2];

@@ -136,6 +136,6 @@ });

var object = { val: true };
var template = compiler.compile("<div data-foo={{if val \"stuff\" \"\"}}></div>");
var template = compiler.compile('<div data-foo={{if val "stuff" ""}}></div>');
var result = template.render(object, env);
htmlbars_test_helpers.equalTokens(result.fragment, "<div data-foo=\"stuff\"></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div data-foo="stuff"></div>');

@@ -146,3 +146,3 @@ object.val = false;

htmlbars_test_helpers.equalTokens(result.fragment, "<div data-foo=\"\"></div>");
htmlbars_test_helpers.equalTokens(result.fragment, '<div data-foo=""></div>');
});

@@ -252,9 +252,9 @@

test("manualElement function honors namespaces", function () {
htmlbars_runtime.hooks.keywords["manual-element"] = {
htmlbars_runtime.hooks.keywords['manual-element'] = {
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
var attributes = {
version: "1.1"
version: '1.1'
};
var layout = render.manualElement("svg", attributes);
var layout = render.manualElement('svg', attributes);

@@ -265,3 +265,3 @@ hooks.hostBlock(morph, env, scope, template, inverse, null, visitor, function (options) {

render.manualElement(env, scope, "span", attributes, morph);
render.manualElement(env, scope, 'span', attributes, morph);
},

@@ -274,7 +274,7 @@

var template = compiler.compile("{{#manual-element}}<linearGradient><stop offset=\"{{startOffset}}\"></stop><stop offset=\"{{stopOffset}}\"></stop></linearGradient>{{/manual-element}}");
var template = compiler.compile('{{#manual-element}}<linearGradient><stop offset="{{startOffset}}"></stop><stop offset="{{stopOffset}}"></stop></linearGradient>{{/manual-element}}');
var result = template.render({ startOffset: 0.1, stopOffset: 0.6 }, env);
ok(result.fragment.childNodes[1] instanceof SVGElement);
ok(result.fragment.childNodes[1].childNodes[0] instanceof SVGLinearGradientElement);
htmlbars_test_helpers.equalTokens(result.fragment, "<svg version=\"1.1\"><linearGradient><stop offset=\"0.1\"></stop><stop offset=\"0.6\"></stop></linearGradient></svg>");
htmlbars_test_helpers.equalTokens(result.fragment, '<svg version="1.1"><linearGradient><stop offset="0.1"></stop><stop offset="0.6"></stop></linearGradient></svg>');
});

@@ -284,10 +284,10 @@

var attributes = {
class: "foo-bar"
class: 'foo-bar'
};
var layout = render.manualElement("input", attributes);
var layout = render.manualElement('input', attributes);
var fragment = layout.buildFragment(new DOMHelper['default']());
equal(fragment.childNodes.length, 1, "includes a single element");
equal(fragment.childNodes[0].childNodes.length, 0, "no child nodes were added to `<input>` because it is a void tag");
htmlbars_test_helpers.equalTokens(fragment, "<input class=\"foo-bar\">");
equal(fragment.childNodes.length, 1, 'includes a single element');
equal(fragment.childNodes[0].childNodes.length, 0, 'no child nodes were added to `<input>` because it is a void tag');
htmlbars_test_helpers.equalTokens(fragment, '<input class="foo-bar">');
});

@@ -297,7 +297,7 @@

var attributes = {
class: "foo-bar",
other: ["get", "other"]
class: 'foo-bar',
other: ['get', 'other']
};
var element = document.createElement("div");
var element = document.createElement('div');
var raw = render.attachAttributes(attributes);

@@ -311,4 +311,4 @@ raw.element = element;

equal(element.getAttribute("class"), "foo-bar", "the attribute was assigned");
equal(element.getAttribute("other"), "first", "the attribute was assigned");
equal(element.getAttribute('class'), "foo-bar", "the attribute was assigned");
equal(element.getAttribute('other'), "first", "the attribute was assigned");

@@ -318,4 +318,4 @@ self.other = "second";

equal(element.getAttribute("class"), "foo-bar", "the attribute was assigned");
equal(element.getAttribute("other"), "second", "the attribute was assigned");
equal(element.getAttribute('class'), "foo-bar", "the attribute was assigned");
equal(element.getAttribute('other'), "second", "the attribute was assigned");
});

@@ -342,4 +342,4 @@

var attributes = {
class: "foo-bar",
other: ["get", "other"]
class: 'foo-bar',
other: ['get', 'other']
};

@@ -346,0 +346,0 @@

@@ -91,7 +91,7 @@ define('htmlbars-syntax-tests/htmlbars-syntax.jshint', function () {

locEqual(ast, 1, 0, 5, 4, "outer program");
locEqual(ast, 1, 0, 5, 4, 'outer program');
// startColumn should be 13 not 2.
// This should be fixed upstream in Handlebars.
locEqual(ast.body[1].program, 2, 2, 4, 7, "nested program");
locEqual(ast.body[1].program, 2, 2, 4, 7, 'nested program');
});

@@ -102,4 +102,4 @@

locEqual(ast.body[1], 2, 2, 9, 8, "outer block");
locEqual(ast.body[1].program.body[0], 3, 4, 7, 13, "nested block");
locEqual(ast.body[1], 2, 2, 9, 8, 'outer block');
locEqual(ast.body[1].program.body[0], 3, 4, 7, 13, 'nested block');
});

@@ -110,4 +110,4 @@

locEqual(ast.body[1], 2, 4, 2, 11, "outer mustache");
locEqual(ast.body[3].program.body[1], 4, 11, 5, 10, "inner mustache");
locEqual(ast.body[1], 2, 4, 2, 11, 'outer mustache');
locEqual(ast.body[3].program.body[1], 4, 11, 5, 10, 'inner mustache');
});

@@ -118,3 +118,3 @@

locEqual(ast.body[1].modifiers[0], 2, 9, 4, 15, "element modifier");
locEqual(ast.body[1].modifiers[0], 2, 9, 4, 15, 'element modifier');
});

@@ -133,6 +133,6 @@

locEqual(section, 2, 4, 7, 14, "section element");
locEqual(br, 3, 6, 3, 10, "br element");
locEqual(div, 4, 6, 6, 12, "div element");
locEqual(hr, 5, 8, 5, 14, "hr element");
locEqual(section, 2, 4, 7, 14, 'section element');
locEqual(br, 3, 6, 3, 10, 'br element');
locEqual(div, 4, 6, 6, 12, 'div element');
locEqual(hr, 5, 8, 5, 14, 'hr element');
});

@@ -150,6 +150,6 @@

locEqual(page, 2, 4, 7, 14, "page component");
locEqual(header, 3, 6, 3, 29, "header component");
locEqual(input, 4, 6, 4, 18, "input component");
locEqual(footer, 5, 6, 6, 22, "footer component");
locEqual(page, 2, 4, 7, 14, 'page component');
locEqual(header, 3, 6, 3, 29, 'header component');
locEqual(input, 4, 6, 4, 18, 'input component');
locEqual(footer, 5, 6, 6, 22, 'footer component');
});

@@ -175,3 +175,3 @@

function normalizeNode(obj) {
if (obj && typeof obj === "object") {
if (obj && typeof obj === 'object') {
var newObj;

@@ -211,6 +211,6 @@ if (obj.splice) {

if (typeof actual === "string") {
if (typeof actual === 'string') {
actual = parser.preprocess(actual);
}
if (typeof expected === "string") {
if (typeof expected === 'string') {
expected = parser.preprocess(expected);

@@ -226,4 +226,4 @@ }

test("a simple piece of content", function () {
var t = "some content";
astEqual(t, b['default'].program([b['default'].text("some content")]));
var t = 'some content';
astEqual(t, b['default'].program([b['default'].text('some content')]));
});

@@ -240,7 +240,7 @@

astEqual(ast, b['default'].program([b['default'].element("h1", [], [], [b['default'].text("some")]), b['default'].text(" ast "), b['default'].mustache(b['default'].path("foo"))]));
astEqual(ast, b['default'].program([b['default'].element("h1", [], [], [b['default'].text("some")]), b['default'].text(" ast "), b['default'].mustache(b['default'].path('foo'))]));
});
test("self-closed element", function () {
var t = "<g />";
var t = '<g />';
astEqual(t, b['default'].program([b['default'].element("g")]));

@@ -250,3 +250,3 @@ });

test("elements can have empty attributes", function () {
var t = "<img id=\"\">";
var t = '<img id="">';
astEqual(t, b['default'].program([b['default'].element("img", [b['default'].attr("id", b['default'].text(""))])]));

@@ -261,3 +261,3 @@ });

test("html content with html content inline", function () {
var t = "<div><p></p></div>";
var t = '<div><p></p></div>';
astEqual(t, b['default'].program([b['default'].element("div", [], [], [b['default'].element("p")])]));

@@ -267,10 +267,10 @@ });

test("html content with svg content inline", function () {
var t = "<div><svg></svg></div>";
var t = '<div><svg></svg></div>';
astEqual(t, b['default'].program([b['default'].element("div", [], [], [b['default'].element("svg")])]));
});
var integrationPoints = ["foreignObject", "desc", "title"];
var integrationPoints = ['foreignObject', 'desc', 'title'];
function buildIntegrationPointTest(integrationPoint) {
return function integrationPointTest() {
var t = "<svg><" + integrationPoint + "><div></div></" + integrationPoint + "></svg>";
var t = '<svg><' + integrationPoint + '><div></div></' + integrationPoint + '></svg>';
astEqual(t, b['default'].program([b['default'].element("svg", [], [], [b['default'].element(integrationPoint, [], [], [b['default'].element("div")])])]));

@@ -284,3 +284,3 @@ };

test("a piece of content with HTML", function () {
var t = "some <div>content</div> done";
var t = 'some <div>content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].text("content")]), b['default'].text(" done")]));

@@ -290,24 +290,24 @@ });

test("a piece of Handlebars with HTML", function () {
var t = "some <div>{{content}}</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].mustache(b['default'].path("content"))]), b['default'].text(" done")]));
var t = 'some <div>{{content}}</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [], [], [b['default'].mustache(b['default'].path('content'))]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (quoted)", function () {
var t = "some <div class=\"{{foo}}\">content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path("foo")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class="{{foo}}">content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path('foo')]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (unquoted)", function () {
var t = "some <div class={{foo}}>content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].mustache(b['default'].path("foo")))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class={{foo}}>content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].mustache(b['default'].path('foo')))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute (sexprs)", function () {
var t = "some <div class=\"{{foo (foo \"abc\")}}\">content</div> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].mustache(b['default'].path("foo"), [b['default'].sexpr(b['default'].path("foo"), [b['default'].string("abc")])])]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <div class="{{foo (foo "abc")}}">content</div> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].mustache(b['default'].path('foo'), [b['default'].sexpr(b['default'].path('foo'), [b['default'].string('abc')])])]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});
test("Handlebars embedded in an attribute with other content surrounding it", function () {
var t = "some <a href=\"http://{{link}}/\">content</a> done";
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("a", [b['default'].attr("href", b['default'].concat([b['default'].string("http://"), b['default'].path("link"), b['default'].string("/")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
var t = 'some <a href="http://{{link}}/">content</a> done';
astEqual(t, b['default'].program([b['default'].text("some "), b['default'].element("a", [b['default'].attr("href", b['default'].concat([b['default'].string("http://"), b['default'].path('link'), b['default'].string("/")]))], [], [b['default'].text("content")]), b['default'].text(" done")]));
});

@@ -317,3 +317,3 @@

var t = "{{embed}} {{some 'content'}} " + "<div class='{{foo}} {{bind-class isEnabled truthy='enabled'}}'>{{ content }}</div>" + " {{more 'embed'}}";
astEqual(t, b['default'].program([b['default'].mustache(b['default'].path("embed")), b['default'].text(" "), b['default'].mustache(b['default'].path("some"), [b['default'].string("content")]), b['default'].text(" "), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path("foo"), b['default'].string(" "), b['default'].mustache(b['default'].path("bind-class"), [b['default'].path("isEnabled")], b['default'].hash([b['default'].pair("truthy", b['default'].string("enabled"))]))]))], [], [b['default'].mustache(b['default'].path("content"))]), b['default'].text(" "), b['default'].mustache(b['default'].path("more"), [b['default'].string("embed")])]));
astEqual(t, b['default'].program([b['default'].mustache(b['default'].path('embed')), b['default'].text(' '), b['default'].mustache(b['default'].path('some'), [b['default'].string('content')]), b['default'].text(' '), b['default'].element("div", [b['default'].attr("class", b['default'].concat([b['default'].path('foo'), b['default'].string(' '), b['default'].mustache(b['default'].path('bind-class'), [b['default'].path('isEnabled')], b['default'].hash([b['default'].pair('truthy', b['default'].string('enabled'))]))]))], [], [b['default'].mustache(b['default'].path('content'))]), b['default'].text(' '), b['default'].mustache(b['default'].path('more'), [b['default'].string('embed')])]));
});

@@ -323,8 +323,8 @@

var t = "{{#if foo}}<div>{{content}}</div>{{/if}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("if"), [b['default'].path("foo")], b['default'].hash(), b['default'].program([b['default'].element("div", [], [], [b['default'].mustache(b['default'].path("content"))])]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('if'), [b['default'].path('foo')], b['default'].hash(), b['default'].program([b['default'].element('div', [], [], [b['default'].mustache(b['default'].path('content'))])]))]));
});
test("Involved block helper", function () {
var t = "<p>hi</p> content {{#testing shouldRender}}<p>Appears!</p>{{/testing}} more <em>content</em> here";
astEqual(t, b['default'].program([b['default'].element("p", [], [], [b['default'].text("hi")]), b['default'].text(" content "), b['default'].block(b['default'].path("testing"), [b['default'].path("shouldRender")], b['default'].hash(), b['default'].program([b['default'].element("p", [], [], [b['default'].text("Appears!")])])), b['default'].text(" more "), b['default'].element("em", [], [], [b['default'].text("content")]), b['default'].text(" here")]));
var t = '<p>hi</p> content {{#testing shouldRender}}<p>Appears!</p>{{/testing}} more <em>content</em> here';
astEqual(t, b['default'].program([b['default'].element('p', [], [], [b['default'].text('hi')]), b['default'].text(' content '), b['default'].block(b['default'].path('testing'), [b['default'].path('shouldRender')], b['default'].hash(), b['default'].program([b['default'].element('p', [], [], [b['default'].text('Appears!')])])), b['default'].text(' more '), b['default'].element('em', [], [], [b['default'].text('content')]), b['default'].text(' here')]));
});

@@ -334,3 +334,3 @@

var t = "<p {{action 'boom'}} class='bar'>Some content</p>";
astEqual(t, b['default'].program([b['default'].element("p", [b['default'].attr("class", b['default'].text("bar"))], [b['default'].elementModifier(b['default'].path("action"), [b['default'].string("boom")])], [b['default'].text("Some content")])]));
astEqual(t, b['default'].program([b['default'].element('p', [b['default'].attr('class', b['default'].text('bar'))], [b['default'].elementModifier(b['default'].path('action'), [b['default'].string('boom')])], [b['default'].text('Some content')])]));
});

@@ -340,3 +340,3 @@

var t = "<input{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -346,3 +346,3 @@

var t = "<input {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -352,3 +352,3 @@

var t = "<input foo{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text(""))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text(''))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -358,3 +358,3 @@

var t = "<input foo {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text(""))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text(''))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -364,3 +364,3 @@

var t = "<input foo=1 {{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text("1"))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text('1'))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -370,3 +370,3 @@

var t = "<input foo='1'{{bar}}>";
astEqual(t, b['default'].program([b['default'].element("input", [b['default'].attr("foo", b['default'].text("1"))], [b['default'].elementModifier(b['default'].path("bar"))])]));
astEqual(t, b['default'].program([b['default'].element('input', [b['default'].attr('foo', b['default'].text('1'))], [b['default'].elementModifier(b['default'].path('bar'))])]));
});

@@ -376,6 +376,6 @@

var t = "foo {{~content}} bar";
astEqual(t, b['default'].program([b['default'].text("foo"), b['default'].mustache(b['default'].path("content")), b['default'].text(" bar")]));
astEqual(t, b['default'].program([b['default'].text('foo'), b['default'].mustache(b['default'].path('content')), b['default'].text(' bar')]));
t = "foo {{content~}} bar";
astEqual(t, b['default'].program([b['default'].text("foo "), b['default'].mustache(b['default'].path("content")), b['default'].text("bar")]));
astEqual(t, b['default'].program([b['default'].text('foo '), b['default'].mustache(b['default'].path('content')), b['default'].text('bar')]));
});

@@ -385,6 +385,6 @@

var t = "foo {{~#wat}}{{/wat}} bar";
astEqual(t, b['default'].program([b['default'].text("foo"), b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program()), b['default'].text(" bar")]));
astEqual(t, b['default'].program([b['default'].text('foo'), b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program()), b['default'].text(' bar')]));
t = "foo {{#wat}}{{/wat~}} bar";
astEqual(t, b['default'].program([b['default'].text("foo "), b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program()), b['default'].text("bar")]));
astEqual(t, b['default'].program([b['default'].text('foo '), b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program()), b['default'].text('bar')]));
});

@@ -394,12 +394,12 @@

var t = "{{#wat~}} foo {{else}}{{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program([b['default'].text("foo ")]), b['default'].program())]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program([b['default'].text('foo ')]), b['default'].program())]));
t = "{{#wat}} foo {{~else}}{{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program([b['default'].text(" foo")]), b['default'].program())]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program([b['default'].text(' foo')]), b['default'].program())]));
t = "{{#wat}}{{else~}} foo {{/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text("foo ")]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text('foo ')]))]));
t = "{{#wat}}{{else}} foo {{~/wat}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("wat"), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text(" foo")]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('wat'), [], b['default'].hash(), b['default'].program(), b['default'].program([b['default'].text(' foo')]))]));
});

@@ -409,3 +409,3 @@

var t = "{{#each~}}\n <li> foo </li>\n{{~/each}}";
astEqual(t, b['default'].program([b['default'].block(b['default'].path("each"), [], b['default'].hash(), b['default'].program([b['default'].element("li", [], [], [b['default'].text(" foo ")])]))]));
astEqual(t, b['default'].program([b['default'].block(b['default'].path('each'), [], b['default'].hash(), b['default'].program([b['default'].element('li', [], [], [b['default'].text(' foo ')])]))]));
});

@@ -433,3 +433,3 @@

var t = "<x-foo a=b c='d' e={{f}} id='{{bar}}' class='foo-{{bar}}'>{{a}}{{b}}c{{d}}</x-foo>{{e}}";
astEqual(t, b['default'].program([b['default'].component("x-foo", [b['default'].attr("a", b['default'].text("b")), b['default'].attr("c", b['default'].text("d")), b['default'].attr("e", b['default'].mustache(b['default'].path("f"))), b['default'].attr("id", b['default'].concat([b['default'].path("bar")])), b['default'].attr("class", b['default'].concat([b['default'].string("foo-"), b['default'].path("bar")]))], b['default'].program([b['default'].mustache(b['default'].path("a")), b['default'].mustache(b['default'].path("b")), b['default'].text("c"), b['default'].mustache(b['default'].path("d"))])), b['default'].mustache(b['default'].path("e"))]));
astEqual(t, b['default'].program([b['default'].component('x-foo', [b['default'].attr('a', b['default'].text('b')), b['default'].attr('c', b['default'].text('d')), b['default'].attr('e', b['default'].mustache(b['default'].path('f'))), b['default'].attr('id', b['default'].concat([b['default'].path('bar')])), b['default'].attr('class', b['default'].concat([b['default'].string('foo-'), b['default'].path('bar')]))], b['default'].program([b['default'].mustache(b['default'].path('a')), b['default'].mustache(b['default'].path('b')), b['default'].text('c'), b['default'].mustache(b['default'].path('d'))])), b['default'].mustache(b['default'].path('e'))]));
});

@@ -456,3 +456,3 @@

test("an HTML comment", function () {
var t = "before <!-- some comment --> after";
var t = 'before <!-- some comment --> after';
astEqual(t, b['default'].program([b['default'].text("before "), b['default'].comment(" some comment "), b['default'].text(" after")]));

@@ -470,3 +470,3 @@ });

astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path("foo"), [b['default'].null()])]));
astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path('foo'), [b['default'].null()])]));
});

@@ -483,3 +483,3 @@

astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path("foo"), [b['default'].undefined()])]));
astEqual(ast, b['default'].program([b['default'].mustache(b['default'].path('foo'), [b['default'].undefined()])]));
});

@@ -502,5 +502,5 @@

QUnit.module("Compiler plugins: AST");
QUnit.module('Compiler plugins: AST');
test("AST plugins can be provided to the compiler", function () {
test('AST plugins can be provided to the compiler', function () {
expect(1);

@@ -510,6 +510,6 @@

Plugin.prototype.transform = function () {
ok(true, "transform was called!");
ok(true, 'transform was called!');
};
parser.preprocess("<div></div>", {
parser.preprocess('<div></div>', {
plugins: {

@@ -521,3 +521,3 @@ ast: [Plugin]

test("provides syntax package as `syntax` prop if value is null", function () {
test('provides syntax package as `syntax` prop if value is null', function () {
expect(1);

@@ -530,3 +530,3 @@

parser.preprocess("<div></div>", {
parser.preprocess('<div></div>', {
plugins: {

@@ -538,3 +538,3 @@ ast: [Plugin]

test("AST plugins can modify the AST", function () {
test('AST plugins can modify the AST', function () {
expect(1);

@@ -549,3 +549,3 @@

var ast = parser.preprocess("<div></div>", {
var ast = parser.preprocess('<div></div>', {
plugins: {

@@ -556,6 +556,6 @@ ast: [Plugin]

equal(ast, expected, "return value from AST transform is used");
equal(ast, expected, 'return value from AST transform is used');
});
test("AST plugins can be chained", function () {
test('AST plugins can be chained', function () {
expect(2);

@@ -572,8 +572,8 @@

SecondaryPlugin.prototype.transform = function (ast) {
equal(ast, expected, "return value from AST transform is used");
equal(ast, expected, 'return value from AST transform is used');
return "BOOM!";
return 'BOOM!';
};
var ast = parser.preprocess("<div></div>", {
var ast = parser.preprocess('<div></div>', {
plugins: {

@@ -584,3 +584,3 @@ ast: [Plugin, SecondaryPlugin]

equal(ast, "BOOM!", "return value from last AST transform is used");
equal(ast, 'BOOM!', 'return value from last AST transform is used');
});

@@ -587,0 +587,0 @@

@@ -95,6 +95,6 @@ define('htmlbars-tests/htmlbars-compiler.jshint', function () {

QUnit.module("htmlbars");
QUnit.module('htmlbars');
test("compile is exported", function () {
ok(typeof htmlbars.compile === "function", "compile is exported");
ok(typeof htmlbars.compile === 'function', 'compile is exported');
});

@@ -101,0 +101,0 @@

@@ -5,6 +5,6 @@ define('htmlbars-util-tests/htmlbars-util-test', ['../htmlbars-util'], function (htmlbars_util) {

QUnit.module("htmlbars-util");
QUnit.module('htmlbars-util');
test("SafeString is exported", function () {
ok(typeof htmlbars_util.SafeString === "function", "SafeString is exported");
ok(typeof htmlbars_util.SafeString === 'function', 'SafeString is exported');
});

@@ -11,0 +11,0 @@

@@ -36,3 +36,3 @@ define('htmlbars-test-helpers', ['exports', '../simple-html-tokenizer', '../htmlbars-util/array-utils'], function (exports, simple_html_tokenizer, array_utils) {

var div = document.createElement("div");
if (typeof fragmentOrHtml === "string") {
if (typeof fragmentOrHtml === 'string') {
div.innerHTML = fragmentOrHtml;

@@ -45,2 +45,3 @@ } else {

}
function equalTokens(fragment, html, message) {

@@ -58,3 +59,3 @@ if (fragment.fragment) {

function normalizeTokens(token) {
if (token.type === "StartTag") {
if (token.type === 'StartTag') {
token.attributes = token.attributes.sort(function (a, b) {

@@ -89,8 +90,9 @@ if (a[0] > b[0]) {

}
var div = document.createElement("div");
var node = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var div = document.createElement('div');
var node = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
div.appendChild(node);
var clone = div.cloneNode(true);
return clone.innerHTML === "<svg xmlns=\"http://www.w3.org/2000/svg\" />";
return clone.innerHTML === '<svg xmlns="http://www.w3.org/2000/svg" />';
})();
function normalizeInnerHTML(actualHTML) {

@@ -100,6 +102,6 @@ if (ieSVGInnerHTML) {

// drop namespace attribute
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, "");
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, '');
// replace self-closing elements
actualHTML = actualHTML.replace(/<([^ >]+) [^\/>]*\/>/gi, function (tag, tagName) {
return tag.slice(0, tag.length - 3) + "></" + tagName + ">";
return tag.slice(0, tag.length - 3) + '></' + tagName + '>';
});

@@ -112,5 +114,6 @@ }

// detect weird IE8 checked element string
var checkedInput = document.createElement("input");
checkedInput.setAttribute("checked", "checked");
var checkedInput = document.createElement('input');
checkedInput.setAttribute('checked', 'checked');
var checkedInputString = checkedInput.outerHTML;
function isCheckedInputHTML(element) {

@@ -121,3 +124,4 @@ equal(element.outerHTML, checkedInputString);

// check which property has the node's text content
var textProperty = document.createElement("div").textContent === undefined ? "innerText" : "textContent";
var textProperty = document.createElement('div').textContent === undefined ? 'innerText' : 'textContent';
function getTextContent(el) {

@@ -281,3 +285,3 @@ // textNode

'"': '&quot;',
'\'': '&#x27;',
"'": '&#x27;',
'`': '&#x60;'

@@ -292,2 +296,3 @@ };

}
function extend(obj /* , ...source */) {

@@ -502,2 +507,3 @@ for (var i = 1; i < arguments.length; i++) {

};
function getAttrNamespace(attrName) {

@@ -596,3 +602,3 @@ var namespace;

str = str.replace(/\\/g, "\\\\");
str = str.replace(/"/g, "\\\"");
str = str.replace(/"/g, '\\"');
str = str.replace(/\n/g, "\\n");

@@ -603,3 +609,3 @@ return str;

function string(str) {
return "\"" + escapeString(str) + "\"";
return '"' + escapeString(str) + '"';
}

@@ -723,3 +729,3 @@

}
if (typeof blocks === "function") {
if (typeof blocks === 'function') {
env.hooks.bindBlock(env, shadowScope, blocks);

@@ -734,2 +740,3 @@ } else {

}
function renderAndCleanup(morph, env, options, shadowOptions, callback) {

@@ -889,10 +896,10 @@ // The RenderState object is used to collect information about what the

QUnit.module("AttrMorph");
QUnit.module('AttrMorph');
test("can update a dom node", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
morph.setContent("twang");
equal(element.id, "twang", "id property is set");
equal(element.getAttribute("id"), "twang", "id attribute is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent('twang');
equal(element.id, 'twang', 'id property is set');
equal(element.getAttribute('id'), 'twang', 'id attribute is set');
});

@@ -902,4 +909,4 @@

expect(0);
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.clear();

@@ -910,68 +917,68 @@ });

expect(1);
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.destroy();
equal(morph.element, null, "clears element from morph");
equal(morph.element, null, 'clears element from morph');
});
test("can update property", function () {
var element = domHelper.createElement("input");
var morph = domHelper.createAttrMorph(element, "disabled");
var element = domHelper.createElement('input');
var morph = domHelper.createAttrMorph(element, 'disabled');
morph.setContent(true);
equal(element.disabled, true, "disabled property is set");
equal(element.disabled, true, 'disabled property is set');
morph.setContent(false);
equal(element.disabled, false, "disabled property is set");
equal(element.disabled, false, 'disabled property is set');
});
test("does not add undefined properties on initial render", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent(undefined);
equal(element.id, "", "property should not be set");
morph.setContent("foo-bar");
equal(element.id, "foo-bar", "property should be set");
equal(element.id, '', 'property should not be set');
morph.setContent('foo-bar');
equal(element.id, 'foo-bar', 'property should be set');
});
test("does not add null properties on initial render", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "id");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'id');
morph.setContent(null);
equal(element.id, "", "property should not be set");
morph.setContent("foo-bar");
equal(element.id, "foo-bar", "property should be set");
equal(element.id, '', 'property should not be set');
morph.setContent('foo-bar');
equal(element.id, 'foo-bar', 'property should be set');
});
test("can update attribute", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "data-bop");
morph.setContent("kpow");
equal(element.getAttribute("data-bop"), "kpow", "data-bop attribute is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'data-bop');
morph.setContent('kpow');
equal(element.getAttribute('data-bop'), 'kpow', 'data-bop attribute is set');
morph.setContent(null);
equal(element.getAttribute("data-bop"), undefined, "data-bop attribute is removed");
equal(element.getAttribute('data-bop'), undefined, 'data-bop attribute is removed');
});
test("can remove ns attribute with null", function () {
var element = domHelper.createElement("svg");
domHelper.setAttribute(element, "xlink:title", "Great Title", xlinkNamespace);
var morph = domHelper.createAttrMorph(element, "xlink:title", xlinkNamespace);
var element = domHelper.createElement('svg');
domHelper.setAttribute(element, 'xlink:title', 'Great Title', xlinkNamespace);
var morph = domHelper.createAttrMorph(element, 'xlink:title', xlinkNamespace);
morph.setContent(null);
equal(element.getAttribute("xlink:title"), undefined, "ns attribute is removed");
equal(element.getAttribute('xlink:title'), undefined, 'ns attribute is removed');
});
test("can remove attribute with undefined", function () {
var element = domHelper.createElement("div");
element.setAttribute("data-bop", "kpow");
var morph = domHelper.createAttrMorph(element, "data-bop");
var element = domHelper.createElement('div');
element.setAttribute('data-bop', 'kpow');
var morph = domHelper.createAttrMorph(element, 'data-bop');
morph.setContent(undefined);
equal(element.getAttribute("data-bop"), undefined, "data-bop attribute is removed");
equal(element.getAttribute('data-bop'), undefined, 'data-bop attribute is removed');
});
test("can remove ns attribute with undefined", function () {
var element = domHelper.createElement("svg");
domHelper.setAttribute(element, "xlink:title", "Great Title", xlinkNamespace);
var morph = domHelper.createAttrMorph(element, "xlink:title", xlinkNamespace);
var element = domHelper.createElement('svg');
domHelper.setAttribute(element, 'xlink:title', 'Great Title', xlinkNamespace);
var morph = domHelper.createAttrMorph(element, 'xlink:title', xlinkNamespace);
morph.setContent(undefined);
equal(element.getAttribute("xlink:title"), undefined, "ns attribute is removed");
equal(element.getAttribute('xlink:title'), undefined, 'ns attribute is removed');
});

@@ -981,20 +988,20 @@

domHelper.setNamespace(svgNamespace);
var element = domHelper.createElement("svg");
var morph = domHelper.createAttrMorph(element, "height");
morph.setContent("50%");
equal(element.getAttribute("height"), "50%", "svg attr is set");
var element = domHelper.createElement('svg');
var morph = domHelper.createAttrMorph(element, 'height');
morph.setContent('50%');
equal(element.getAttribute('height'), '50%', 'svg attr is set');
morph.setContent(null);
equal(element.getAttribute("height"), undefined, "svg attr is removed");
equal(element.getAttribute('height'), undefined, 'svg attr is removed');
});
test("can update style attribute", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "style");
morph.setContent("color: red;");
equal(element.getAttribute("style"), "color: red;", "style attr is set");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'style');
morph.setContent('color: red;');
equal(element.getAttribute('style'), 'color: red;', 'style attr is set');
morph.setContent(null);
equal(element.getAttribute("style"), undefined, "style attr is removed");
equal(element.getAttribute('style'), undefined, 'style attr is removed');
});
var badTags = [{ tag: "a", attr: "href" }, { tag: "body", attr: "background" }, { tag: "link", attr: "href" }, { tag: "img", attr: "src" }, { tag: "iframe", attr: "src" }];
var badTags = [{ tag: 'a', attr: 'href' }, { tag: 'body', attr: 'background' }, { tag: 'link', attr: 'href' }, { tag: 'img', attr: 'src' }, { tag: 'iframe', attr: 'src' }];

@@ -1008,5 +1015,5 @@ for (var i = 0, l = badTags.length; i < l; i++) {

var morph = domHelper.createAttrMorph(element, subject.attr);
morph.setContent("javascript://example.com");
morph.setContent('javascript://example.com');
equal(element.getAttribute(subject.attr), "unsafe:javascript://example.com", "attribute is escaped");
equal(element.getAttribute(subject.attr), 'unsafe:javascript://example.com', 'attribute is escaped');
});

@@ -1018,8 +1025,8 @@

try {
morph.setContent(new SafeString['default']("javascript://example.com"));
morph.setContent(new SafeString['default']('javascript://example.com'));
equal(element.getAttribute(subject.attr), "javascript://example.com", "attribute is not escaped");
equal(element.getAttribute(subject.attr), 'javascript://example.com', 'attribute is not escaped');
} catch (e) {
// IE does not allow javascript: to be set on img src
ok(true, "caught exception " + e);
ok(true, 'caught exception ' + e);
}

@@ -1032,8 +1039,8 @@ });

try {
morph.setContent("javascript://example.com");
morph.setContent('javascript://example.com');
equal(element.getAttribute(subject.attr), "javascript://example.com", "attribute is not escaped");
equal(element.getAttribute(subject.attr), 'javascript://example.com', 'attribute is not escaped');
} catch (e) {
// IE does not allow javascript: to be set on img src
ok(true, "caught exception " + e);
ok(true, 'caught exception ' + e);
}

@@ -1047,6 +1054,6 @@ });

test("detects attribute's namespace if it is not passed as an argument", function () {
var element = domHelper.createElement("div");
var morph = domHelper.createAttrMorph(element, "xlink:href");
morph.setContent("#circle");
equal(element.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink", "attribute has correct namespace");
var element = domHelper.createElement('div');
var morph = domHelper.createAttrMorph(element, 'xlink:href');
morph.setContent('#circle');
equal(element.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink', 'attribute has correct namespace');
});

@@ -1056,13 +1063,13 @@

domHelper.setNamespace(svgNamespace);
var element = domHelper.createElement("svg");
var morph = domHelper.createAttrMorph(element, "xlink:href", "http://www.w3.org/1999/xlink");
morph.setContent("#other");
equal(element.getAttributeNS("http://www.w3.org/1999/xlink", "href"), "#other", "namespaced attr is set");
equal(element.attributes[0].namespaceURI, "http://www.w3.org/1999/xlink");
equal(element.attributes[0].name, "xlink:href");
equal(element.attributes[0].localName, "href");
equal(element.attributes[0].value, "#other");
var element = domHelper.createElement('svg');
var morph = domHelper.createAttrMorph(element, 'xlink:href', 'http://www.w3.org/1999/xlink');
morph.setContent('#other');
equal(element.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), '#other', 'namespaced attr is set');
equal(element.attributes[0].namespaceURI, 'http://www.w3.org/1999/xlink');
equal(element.attributes[0].name, 'xlink:href');
equal(element.attributes[0].localName, 'href');
equal(element.attributes[0].value, '#other');
morph.setContent(null);
// safari returns '' while other browsers return undefined
equal(!!element.getAttributeNS("http://www.w3.org/1999/xlink", "href"), false, "namespaced attr is removed");
equal(!!element.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), false, 'namespaced attr is removed');
});

@@ -1072,7 +1079,7 @@ }

test("embed src as data uri is sanitized", function () {
var element = document.createElement("embed");
var morph = domHelper.createAttrMorph(element, "src");
morph.setContent("data:image/svg+xml;base64,PH");
var element = document.createElement('embed');
var morph = domHelper.createAttrMorph(element, 'src');
morph.setContent('data:image/svg+xml;base64,PH');
equal(element.getAttribute("src"), "unsafe:data:image/svg+xml;base64,PH", "attribute is escaped");
equal(element.getAttribute('src'), 'unsafe:data:image/svg+xml;base64,PH', 'attribute is escaped');
});

@@ -1097,5 +1104,5 @@

QUnit.module("sanitizeAttributeValue(null, \"*\")");
QUnit.module('sanitizeAttributeValue(null, "*")');
var goodProtocols = ["https", "http", "ftp", "tel", "file"];
var goodProtocols = ['https', 'http', 'ftp', 'tel', 'file'];

@@ -1107,13 +1114,13 @@ for (var i = 0, l = goodProtocols.length; i < l; i++) {

function buildProtocolTest(protocol) {
test("allows " + protocol + " protocol when element is not provided", function () {
test('allows ' + protocol + ' protocol when element is not provided', function () {
expect(1);
var attributeValue = protocol + "://foo.com";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = protocol + '://foo.com';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, attributeValue, "protocol not escaped");
equal(actual, attributeValue, 'protocol not escaped');
});
}
test("blocks javascript: protocol", function () {
test('blocks javascript: protocol', function () {
/* jshint scripturl:true */

@@ -1123,9 +1130,9 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});
test("blocks blacklisted protocols", function () {
test('blocks blacklisted protocols', function () {
/* jshint scripturl:true */

@@ -1135,9 +1142,9 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", attributeValue);
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});
test("does not block SafeStrings", function () {
test('does not block SafeStrings', function () {
/* jshint scripturl:true */

@@ -1147,6 +1154,6 @@

var attributeValue = "javascript:alert(\"foo\")";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, "href", new SafeString['default'](attributeValue));
var attributeValue = 'javascript:alert("foo")';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, null, 'href', new SafeString['default'](attributeValue));
equal(actual, attributeValue, "protocol unescaped");
equal(actual, attributeValue, 'protocol unescaped');
});

@@ -1159,6 +1166,6 @@

var attributeValue = "data:image/svg+xml;base64,...";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: "EMBED" }, "src", attributeValue);
var attributeValue = 'data:image/svg+xml;base64,...';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: 'EMBED' }, 'src', attributeValue);
equal(actual, "unsafe:" + attributeValue, "protocol escaped");
equal(actual, 'unsafe:' + attributeValue, 'protocol escaped');
});

@@ -1171,13 +1178,13 @@

var attributeValue = "data:image/svg+xml;base64,...";
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: "IMG" }, "src", attributeValue);
var attributeValue = 'data:image/svg+xml;base64,...';
var actual = sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: 'IMG' }, 'src', attributeValue);
equal(actual, attributeValue, "protocol should not have been escaped");
equal(actual, attributeValue, 'protocol should not have been escaped');
});
var badTags = ["A", "BODY", "LINK", "IMG", "IFRAME", "BASE", "FORM"];
var badTags = ['A', 'BODY', 'LINK', 'IMG', 'IFRAME', 'BASE', 'FORM'];
var badAttributes = ["href", "src", "background", "action"];
var badAttributes = ['href', 'src', 'background', 'action'];
var someIllegalProtocols = ["javascript", "vbscript"];
var someIllegalProtocols = ['javascript', 'vbscript'];

@@ -1187,4 +1194,4 @@ array_utils.forEach(badTags, function (tagName) {

array_utils.forEach(someIllegalProtocols, function (protocol) {
test(" <" + tagName + " " + attrName + "=\"" + protocol + ":something\"> ...", function () {
equal(sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: tagName }, attrName, protocol + ":something"), "unsafe:" + protocol + ":something");
test(' <' + tagName + ' ' + attrName + '="' + protocol + ':something"> ...', function () {
equal(sanitize_attribute_value.sanitizeAttributeValue(domHelper, { tagName: tagName }, attrName, protocol + ':something'), 'unsafe:' + protocol + ':something');
});

@@ -1191,0 +1198,0 @@ });

var packagesConfig = {
"version": "0.13.34",
"revision": "c418c83b3b3ccef9f8987e6b86ddff7e363c797f",
"version": "0.13.35",
"revision": "5e61659916332536828949f4ead846054cf04fac",
"vendored": {},

@@ -5,0 +5,0 @@ "dependencies": {

{
"name": "htmlbars",
"version": "0.13.34",
"version": "0.13.35",
"description": "HTMLBars compiles Handlebars templates into document fragments rather than string buffers",

@@ -5,0 +5,0 @@ "main": "dist/cjs/htmlbars.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc