Test presence of elements before manipulating them in global application.js.