restore document from global.document

has a bug in nodes to access global.document