Changelog
1.2.1
xsi:type
definitions in the binding template.Changelog
1.2.0
xsi:type
. Check
the README for
details and https://github.com/wspringer/cruftless/issues/58 for the original
issue.Changelog
1.1.4
Changelog
1.1.3
Changelog
1.1.0
f8ac631: Support for a simpler way to map arrays of non-object values.
Instead of binding as array
, we're binding as values. With array
, every encounter of the element results in a new object getting added to the array. With values
, we're not adding any values yet. However, if inside, we encounter something that is bound to value
, it will be added to the array as simple value.
Perhaps this example makes it easier to grasp:
const template = parse(
`<foo><bar c-bind="numbers|values">{{value|integer}}</bar></foo>`
);
const data = template.fromXML(`<foo><bar>1</bar><bar>2</bar></foo>`);
// { numbers: [ 1, 2 ] }
Instead of this:
const template = parse(
`<foo><bar c-bind="numbers|array">{{value|integer}}</bar></foo>`
);
const data = template.fromXML(`<foo><bar>1</bar><bar>2</bar></foo>`);
// { numbers: [ { value: 1 }, { value: 2 } ] }
Note that we currently consider this feature to be unstable. You can use it, but be advised that the notation might change in the future.
Changelog
1.0.0
88f9ea8: Drop pattern matching approach causing parsing issues
Before, there used to be a mechanism that would allow you to have the same element multiple times within the same template. Only if there would be an exact match with the elements attributes, it would be considered to be decoded based on whatever the template was suggesting.
<foo>
<bar a="1">{first}</bar>
<bar a="2">{second}</bar>
</foo>
Given this template and a file like this:
<foo>
<bar a="2">yay</bar>
</foo>
… the resulting data object would be this:
{
"second": "yay"
}
It turned out that this was actually causing parsing issues in case the XML serializer decided to introduce namespaces on an element that didn't have a namespace before. Since the mechanism was never in use — as far as I can tell — I decided to drop it.