flatiron / plates

Light-weight, logic-less, DSL-free, templates for all javascript environments!
MIT License
831 stars 69 forks source link

Some mappings fail depending on the order #80

Closed tizzo closed 12 years ago

tizzo commented 12 years ago

I have been having trouble with plates on v0.6.12 where plates mappings are sometimes ignored depending on the order they're specified. Here is an example to reproduce:

The following works:

Plates = require('plates');
var html = '<a class="ticket-search-title" href="foo">title</a></td><td>';
data = { 'url': 'http://github.com', 'title': 'Github' };
map = Plates.Map();
map.class('ticket-search-title').use('title');
map.class('ticket-search-title').use('url').as('href');
console.log(Plates.bind(html, data, map));

It outputs: <a class="ticket-search-title" href="http://github.com">Github</a>

The following fails:

Plates = require('plates');
var html = '<a class="ticket-search-title" href="foo">title</a></td><td>';
data = { 'url': 'http://github.com', 'title': 'Github' };
map = Plates.Map();
map.class('ticket-search-title').use('url').as('href');
map.class('ticket-search-title').use('title');
console.log(Plates.bind(html, data, map));

It outputs: <a class="ticket-search-title" href="foo">Github</a>

heapwolf commented 12 years ago

this appears to have been fixed with b0515b8b159f725266052462a06d1c6f083bc8c.