js performance improvement: less DOM firing