Use "doc" instead of "document"

This makes it work in jsdom since document is not global there.