We shouldn't be setting this on the document, please make it a local function instead.