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

support css selectors #61

Open
max-mapper opened this issue Apr 16, 2012 · 5 comments
Open

support css selectors #61

max-mapper opened this issue Apr 16, 2012 · 5 comments

Comments

@max-mapper
Copy link

instead of this:

var html = '<span class="name">User</span>...<span class="name">User</span>'
var data = { "username": "John Smith" }
var map = Plates.Map()
map.class('name').to('username')
console.log(Plates.bind(html, data, map))

i want to do this:

var html = '<span class="name">User</span>...<span id="name">User</span>'
var data = { ".username": "John Smith", "#username": "Bob Hope" }
console.log(Plates.bind(html, data, map))
@dscape
Copy link
Contributor

dscape commented Apr 16, 2012

I didn't write plates but from conversations I had with Paolo about it I think this is a bad idea.

Plates is super fast and simple. It does so by parsing very little and being very picky in the battles it fights.

For some degree of CSS selectors (like the ones your shown) it might be possible to do, but some other would imply a full parser which is not what plates does (or used to do when I last looked at it)

@dscape
Copy link
Contributor

dscape commented Apr 16, 2012

Still love you max dickbag

@jfhbrook
Copy link
Contributor

One nice thing is that cheerio already does the hard part of implementing css selectors. :)

@pksunkara
Copy link
Contributor

Yeah, cheerio does but it also does things which are not required for plates.

I support @dscape on this.

@trusktr
Copy link

trusktr commented Sep 29, 2012

CSS selectors would really be nice. Plates is already really nice, as far at HTML templating.

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

5 participants