use self executing function and defer flag for dom.js script