I've found the option to create attributes when they don't already exists... however, is there any option to allow/disallow undefined attributes?
For example:
var plates = require('plates'),
itemPlate = '<li class="menu-item"></li>',
data = [],
html = '',
map;
data.push({
content : 'item 1',
id : 'item-1'
});
data.push({
content : 'item 2'
});
map = new plates.Map({
create : true
});
map
.className('menu-item')
.to('content')
.className('menu-item')
.use('id').as('id');
html = plates.bind(itemPlate, data, map);
console.log(html);
// <li class="menu-item" id="item-1">item 1</li><li class="menu-item" id="">item 2</li>
As you can see, I don't really want the id attribute to exist in the 2nd item. I imagine in some cases I might want the attribute to exists and be empty, but not in this one.
Hey there,
I've found the option to create attributes when they don't already exists... however, is there any option to allow/disallow undefined attributes?
For example:
As you can see, I don't really want the
id
attribute to exist in the 2nd item. I imagine in some cases I might want the attribute to exists and be empty, but not in this one.Ta, John