Update dom.js

It is best to access local variables than global