Fixed support for <attr> and <assign> tags

This commit is contained in:
Patrick Steele-Idem 2014-10-22 13:24:46 -06:00
parent 2267e790b0
commit c34ba4dd49
12 changed files with 34 additions and 34 deletions

View File

@ -214,7 +214,7 @@ function handleAttr(node, compiler, template) {
node.addError('Invalid attributes for tag ' + node.toString() + ': ' + invalidAttrs.join(', '));
return;
}
//Cleanup whitespace between <c-attr> tags
//Cleanup whitespace between <attr> tags
if (node.previousSibling && node.previousSibling.isTextNode() && node.previousSibling.getText().trim() === '') {
node.previousSibling.detach();
}
@ -238,7 +238,7 @@ function handleAttr(node, compiler, template) {
function findNestedAttrs(node, compiler, template) {
node.forEachChild(function (child) {
if (child.qName === 'c-attr') {
if (child.qName === 'attr') {
handleAttr(child, compiler, template);
}
});

View File

@ -191,7 +191,7 @@
}
}
},
"c-attr": {
"attr": {
"attributes": {
"name": {
"type": "string"
@ -243,7 +243,7 @@
}
}
},
"c-assign": {
"assign": {
"node-class": "./AssignNode",
"attributes": {
"var": {

View File

@ -1,6 +1,6 @@
<div data-attr="Hello &lt;John&gt; &lt;hello&gt;">
<c-attr name="data-nested-attr">Hello &lt;John&gt; <![CDATA[<hello>]]></c-attr>
<c-attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
<attr name="data-nested-attr">Hello &lt;John&gt; <![CDATA[<hello>]]></attr>
<attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
Hello &lt;John&gt;© <![CDATA[<hello>]]>
${startTag:START}
</div>

View File

@ -75,11 +75,11 @@ INVALID
</else>
<div class="test">
<c-attr name="class" value="duplicate"/>
<attr name="class" value="duplicate"/>
</div>
<test-popover title="Popover Title" invalidAttr1="invalidValue1">
<c-attr name="invalidAttr2" value="invalidValue2"/>
<c-attr name="invalidAttr3">invalidValue3</c-attr>
<c-attr name="invalidAttr4" if="invalidIf">invalidValue4</c-attr>
<attr name="invalidAttr2" value="invalidValue2"/>
<attr name="invalidAttr3">invalidValue3</attr>
<attr name="invalidAttr4" if="invalidIf">invalidValue4</attr>
</test-popover>

View File

@ -1,19 +1,19 @@
<var name="active" value="data.active"/>
<test-popover>
<c-attr name="title">Popover Title</c-attr>
<c-attr name="content">Popover Content</c-attr>
<attr name="title">Popover Title</attr>
<attr name="content">Popover Content</attr>
Link Text
</test-popover>
<div>
<c-attr name="class" value="{?active;tab-active}"/>
<c-attr name="align">center</c-attr>
<attr name="class" value="{?active;tab-active}"/>
<attr name="align">center</attr>
</div>
<div>
<c-attr name="title">
<attr name="title">
<for each="color in ['red', 'green', 'blue']"> $color! </for>
</c-attr>
</attr>
</div>

View File

@ -4,7 +4,7 @@
$color
</div>
<c-assign var="colors" value="['orange', 'purple', 'yellow']"/>
<assign var="colors" value="['orange', 'purple', 'yellow']"/>
<div for="color in colors">
$color

View File

@ -9,8 +9,8 @@ $name
<div title="$welcome &lt;hello&gt;" data-name="$name"/>
<div data-attr="Hello $name &lt;hello&gt;">
<c-attr name="data-nested-attr">&lt;Hello> $name <![CDATA[<hello>]]></c-attr>
<c-attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
<attr name="data-nested-attr">&lt;Hello> $name <![CDATA[<hello>]]></attr>
<attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
Hello &lt;John&gt;© <![CDATA[<hello>]]>
${startTag:START}
</div>

View File

@ -1,8 +1,8 @@
<c-template
params="">
<div data-attr="Hello &lt;John&gt; &lt;hello&gt;">
<c-attr name="data-nested-attr">Hello &lt;John&gt; <![CDATA[<hello>]]></c-attr>
<c-attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
<attr name="data-nested-attr">Hello &lt;John&gt; <![CDATA[<hello>]]></attr>
<attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
Hello &lt;John&gt;© <![CDATA[<hello>]]>
${startTag:START}
</div>

View File

@ -79,12 +79,12 @@
</else>
<div class="test">
<c-attr name="class" value="duplicate"/>
<attr name="class" value="duplicate"/>
</div>
<test-popover title="Popover Title" invalidAttr1="invalidValue1">
<c-attr name="invalidAttr2" value="invalidValue2"/>
<c-attr name="invalidAttr3">invalidValue3</c-attr>
<c-attr name="invalidAttr4" if="invalidIf">invalidValue4</c-attr>
<attr name="invalidAttr2" value="invalidValue2"/>
<attr name="invalidAttr3">invalidValue3</attr>
<attr name="invalidAttr4" if="invalidIf">invalidValue4</attr>
</test-popover>
</c-template>

View File

@ -2,20 +2,20 @@
params="active">
<test-popover>
<c-attr name="title">Popover Title</c-attr>
<c-attr name="content">Popover Content</c-attr>
<attr name="title">Popover Title</attr>
<attr name="content">Popover Content</attr>
Link Text
</test-popover>
<div>
<c-attr name="class" value="{?active;tab-active}"/>
<c-attr name="align">center</c-attr>
<attr name="class" value="{?active;tab-active}"/>
<attr name="align">center</attr>
</div>
<div>
<c-attr name="title">
<attr name="title">
<for each="color in ['red', 'green', 'blue']"> $color! </for>
</c-attr>
</attr>
</div>
</c-template>

View File

@ -6,7 +6,7 @@
$color
</div>
<c-assign var="colors" value="['orange', 'purple', 'yellow']"/>
<assign var="colors" value="['orange', 'purple', 'yellow']"/>
<div for="color in colors">
$color

View File

@ -9,8 +9,8 @@
<div title="$welcome &lt;hello&gt;" data-name="$name"/>
<div data-attr="Hello $name &lt;hello&gt;">
<c-attr name="data-nested-attr">&lt;Hello> $name <![CDATA[<hello>]]></c-attr>
<c-attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
<attr name="data-nested-attr">&lt;Hello> $name <![CDATA[<hello>]]></attr>
<attr name="data-nested-attr2" value="Hello &lt;John&gt; &lt;hello&gt;"/>
Hello &lt;John&gt;© <![CDATA[<hello>]]>
${startTag:START}
</div>