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

cacheElements with queryAll #107

Closed
vwasteels opened this Issue Mar 6, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@vwasteels

vwasteels commented Mar 6, 2015

Is there a way to use this.cacheElements()to cache a set of elements ?

for now I have to do it manually :

    render: function() {
        this.renderWithTemplate();
        this.socialContentsEl = this.queryAll('.tile-social-content [class^="tile-social-"]');
    },

and i'd like to do it that way :

    render: function() {
        this.renderWithTemplate();
        this.socialContentsEl({
            : '.tile-social-content [class^="tile-social-"]',
          });
    },

but in this case, this.socialContentsEl returns the first element only

@bear bear added the question label Mar 6, 2015

@cdaringe

This comment has been minimized.

Show comment
Hide comment
@cdaringe

cdaringe Apr 6, 2015

Member

hey @vwasteels, per the source there is not. Because of the ambiguity & uncertainty of the returned elements, &-js would not know how you would like those cached. I.e. how would your elements get stored onto obj? this.titleSocial1?, this.title_social_el_0?, etc etc. I'd recommend that you add a sugar function to do the query, and index on key definitions as you see fit.

Let me know if that was unclear! If you have an idea about a standard way to do it that could be beneficial, please share. 😄

Member

cdaringe commented Apr 6, 2015

hey @vwasteels, per the source there is not. Because of the ambiguity & uncertainty of the returned elements, &-js would not know how you would like those cached. I.e. how would your elements get stored onto obj? this.titleSocial1?, this.title_social_el_0?, etc etc. I'd recommend that you add a sugar function to do the query, and index on key definitions as you see fit.

Let me know if that was unclear! If you have an idea about a standard way to do it that could be beneficial, please share. 😄

@cdaringe cdaringe closed this Apr 6, 2015

@bear bear removed the question label Apr 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment