I've just recently asked the folloiwng question with regard to jQuery chaning:
A number of people replied with the suggestion that maybe I reduced the amount of chaining within the statement, and instead stored objects in holding variables, which makes sense to me.
However, my understanding is that the objects within a chain are already held on a stack (of sorts), so is the caching/storing of the results in a variable not effectively re-storing it, using more memory?
A comment on one of the posts seemed to indicate that there might not be too much of a performance hit (if any), so I would be happy to cache as suggested if it would be much more readable.
And also, if we are using caching, does this not then start limiting the usefulness of .end()
and .andSelf()
?