-
Notifications
You must be signed in to change notification settings - Fork 396
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 Classes #125
Comments
When initialising, you can use any selector supported by You can also do ractive = new Ractive({
el: 'aside .inner', // or whatever
template: '#tpl'
});
// later...
width = ractive.find( '.yardstick' ).clientWidth; Does this answer the question? Let me know if I can close this issue. Thanks |
However is that only for the element, and not the template? If it works for both then I see this as able to be closed, but from my attempts I haven't been able to use classes with templates. |
Yes - it's very hard to tell if a string is a selector (for an element containing a template) or the template itself, so only strings that begin with a |
Wouldn't it be easier to split the two rather than attempting to support both in one tag (easier, but presents more problems than pros), by having Just a thought, another thought: You could check to see whether the string has html elements or mustache tags, if it does not the it must be a selector. |
I see where you're coming from. I'm always hesitant about adding new options and methods though unless they're absolutely necessary, and personally I haven't come across a situation where I had any need for grabbing templates from elements without IDs. (This is probably because in the course of developing Ractive I've discovered what happens if you let a browser parse HTML before JavaScript gets its hands on it with Future versions of Ractive will have support for nested components (it's in there now, in an experimental form) which should make things easier - in the meantime, could you elaborate on your use case to help me understand whether this is something that needs to be supported? Thanks |
wouldn't a template always start with a '<' ? On Mon, Aug 12, 2013 at 11:25 PM, Rich-Harris [email protected]:
|
Not necessarily! Most would but it's by no means guaranteed - I often have element-less templates when I'm testing, if a starting '<' was a requirement it would cause all manner of confusion |
I forgot to respond to this, most of it is conflicting names and I got around it by appending stuff and was just wondering if you ever thought to support it. It would also make using ractive a lot easier as el and template aren't really explained as to what they support being passed along. |
Ah ok. It's not on the roadmap right now as I don't see a widespread need for this, and as you say it can easily be worked around. Take your point about the documentation - it was slightly out of date, I've just updated the wiki. |
Any intent to support classes, or a more in-depth selection capability for elements and templates?
The text was updated successfully, but these errors were encountered: