diff --git a/delite/createRenderer.js b/delite/createRenderer.js index 9c458e9..096eba8 100644 --- a/delite/createRenderer.js +++ b/delite/createRenderer.js @@ -55,8 +55,8 @@ define([ template._instanceData = this.instanceData; } this.own(template.instantiate(this).insertBefore(this))[0].content; - forEach.call(this.querySelectorAll("[data-attach-point]"), function (elem) { - var value = elem.getAttribute("data-attach-point"); + forEach.call(this.querySelectorAll("[attach-point],[data-attach-point]"), function (elem) { + var value = elem.getAttribute("attach-point") || elem.getAttribute("data-attach-point"); if (value) { this[value] = elem; } diff --git a/tests/delite/createRenderer.js b/tests/delite/createRenderer.js index 9f344a9..6d25364 100644 --- a/tests/delite/createRenderer.js +++ b/tests/delite/createRenderer.js @@ -20,6 +20,7 @@ define([ "../../delite/createRenderer!./templates/nestedWidgetTemplate.html", "../../delite/createRenderer!./templates/complexAttributeTemplate.html", "../../delite/createRenderer!./templates/attachPointTemplate.html", + "../../delite/createRenderer!./templates/dataAttachPointTemplate.html", "../../delite/createRenderer!./templates/simpleWithAlternateBindingTemplate.html", "../../delite/createRenderer!../templates/eventTemplate.html", "deliteful/StarRating", @@ -47,6 +48,7 @@ define([ renderNestedWidgetTemplate, renderComplexAttributeTemplate, renderAttachPointTemplate, + renderDataAttachPointTemplate, renderAlternateBindingTemplate, renderEventsTemplate ) { @@ -91,6 +93,10 @@ define([ render: renderAttachPointTemplate, baseClass: "liaison-test-attachpoint" }), + DataAttachPointTemplateWidget = register("liaison-test-dataattachpoint", [HTMLElement, Widget], { + render: renderDataAttachPointTemplate, + baseClass: "liaison-test-dataattachpoint" + }), AlternateBindingTemplateWidget = register("liaison-test-alternatebinding", [HTMLElement, Widget], { render: renderAlternateBindingTemplate, baseClass: "liaison-test-alternatebinding", @@ -523,6 +529,20 @@ define([ expect(w.valueNode).to.equal(w.querySelector("input")); }); }); + it("Attach point with alternate attribute name", function () { + var w = new DataAttachPointTemplateWidget().placeAt(document.body); + this.timeout = 10000; + handles.push({ + remove: function () { + w.destroy(); + } + }); + return waitFor(function () { + return w.valueNode; + }).then(function () { + expect(w.valueNode).to.equal(w.querySelector("input")); + }); + }); it("Simple binding with default alternate binding factory", function () { var w = new AlternateBindingTemplateWidget({ first: "John" diff --git a/tests/delite/templates/attachPointTemplate.html b/tests/delite/templates/attachPointTemplate.html index e207d46..d0c97af 100644 --- a/tests/delite/templates/attachPointTemplate.html +++ b/tests/delite/templates/attachPointTemplate.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/delite/templates/dataAttachPointTemplate.html b/tests/delite/templates/dataAttachPointTemplate.html new file mode 100644 index 0000000..e207d46 --- /dev/null +++ b/tests/delite/templates/dataAttachPointTemplate.html @@ -0,0 +1 @@ + \ No newline at end of file