Use `contains` method of DOM indtead of loop.