Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quirky behavior for tags that have multiple classes #91

Open
natesilva opened this issue Nov 1, 2012 · 2 comments
Open

Quirky behavior for tags that have multiple classes #91

natesilva opened this issue Nov 1, 2012 · 2 comments

Comments

@natesilva
Copy link

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));
@henriknorberg
Copy link

Got the same problem, had to use ID get around it.

@tizzo
Copy link

tizzo commented Feb 11, 2013

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants