Fixed issue in IE10 causing "redeclaration of const property"

The NodeJS fixed isn't liked in IE. Moving it inside the closure allows document to be set locally only.