Cache selector in afterRender function

- cache selector in a variable to prevent recomputing it in the function.
Merge pull request #1046 from buddhamagnet/cache-selector-in-after-render

Cache selector in afterRender function