-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add method to get element by id #16
Comments
Can you use |
document.querySelector I think its too long, thats why we have this module, right?) app.extend({
init: function () {
var self = this,
views = {},
models = {},
router = new Router(),
user = new User();
app.views = views;
app.models = models;
app.router = router;
app.user = user;
views.main = new MainView({
el: document.body
});
views.content = new ContentView({
el: dom.byId('content')
});
views.appBar = new AppBarView({
el: dom.byId('appBar'),
model: user
});
window.app = app;
// Create and fire up the router
router.history.start();
}
}); |
Sorry, I was using the native browser api, I'm still not sure we want this personally (would like to hear from other users please). view.query('#foo') works, from what I can tell. Adding a specific byId seems to me like an endorsement of using ids which I think we are trying to not endorse. Ids are a bit of an anitpattern as far as I know. This is (one of the reasons) why we have the data-hook language in the docs. |
Sometimes I need to attach view to a specific element. So, it would be good to have short version of getElementById, like dom.byId(id)
The text was updated successfully, but these errors were encountered: