Using Plates 0.4.8, it seems that tags with multiple class names can make mappings fail.
Here I’ve tried to bind the href attribute of an <a> tag. It works, but only if the tag has just one class name. If the tag has multiple class names, it fails.
var Plates = require('plates');
var html = '<a class="class1 class2" href="#">Foo</a>';
var data = { 'url': 'http://google.com/' };
// *** TEST 1
// doesn't work at all
var map1 = Plates.Map();
map1.class('class1').use('url').as('href');
console.log(Plates.bind(html, data, map1));
// *** TEST 2
// remove the "as" clause
// result: does something but not what I want it to do
var map2 = Plates.Map();
map2.class('class1').use('url');
console.log(Plates.bind(html, data, map2));
// *** TEST 3
// remove the additional class name
// result: works, but I had to get rid of a class that I might want
html = '<a class="class1" href="#">Foo</a>';
var map3 = Plates.Map();
map3.class('class1').use('url').as('href');
console.log(Plates.bind(html, data, map3));
Using Plates 0.4.8, it seems that tags with multiple class names can make mappings fail.
Here I’ve tried to bind the
href
attribute of an<a>
tag. It works, but only if the tag has just one class name. If the tag has multiple class names, it fails.