If your element has an id, you can just reference it from the window scope. The const page = is useless. Also the body has its own reference under document: document.body replaces document.querySelector('body')
If your element has an id, you can just reference it from the window scope
This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use getElementById instead.
If your element has an id, you can just reference it from the window scope. The
const page =is useless. Also the body has its own reference under document:document.bodyreplacesdocument.querySelector('body')This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use
getElementByIdinstead.Aww man. I only found out about this recently :(
I knew about this feature yeah but it seemed too janky to me (which says something, you should see the rest of my project :P)