-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
Description
I'm going to use this in a production environment. Is there any chance you would either add, or accept a PR for unregistering selectors?
Use case: For a single page app, I'm thinking of writing a Grunt task that will create a JSON object with all of my possible selectors like this:
{
".elem1": {
"min-width": [ "600px" ],
"max-width": ["700px"]
},
".elem2": {
"min-height": ["20em"]
},
".elem3": {
"min-width": ["20em", "30em", "40em"]
}
}I'm not going to pass a laundry list of selectors to elementQuery, but instead, each of my Backbone Views will be responsible for:
- Registering new elementQuery selectors used by the view and calling
refresh()by passingtrue.- Basically, I will be listing the query selectors used for this view like
elQueries: ['.elem1', '.elem2'] - Just after the view has been rendered into the DOM, I will match the selectors from
elQueriesto the Grunt generated JSON object to register only selectors needed for a given view.
- Basically, I will be listing the query selectors used for this view like
- Unregistering elementQuery selectors that are no longer on the page (ie, when the view closes)
How does everyone feel about something like this?