Remove unnecessary DOM traversals by chaining and caching objects