Bind key handlers to window only if the dom element is the document