support css selectors #61

Open
maxogden opened this Issue Apr 16, 2012 · 5 comments

Projects

None yet

5 participants

@maxogden

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
Member
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
Member
dscape commented Apr 16, 2012

Still love you max dickbag

@jfhbrook
Contributor

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

@pksunkara
Contributor

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

I support @dscape on this.

@trusktr
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