共计 803 个字符,预计需要花费 3 分钟才能阅读完成。
在上面这个 StackOverflow 的线索里进行了探讨:
https://stackoverflow.com/que…
window
Window is the main JavaScript object root, aka the global object in a browser, also can be treated as the root of the document object model. You can access it as window
相当于 浏览器 JavaScript 编程环境里的 root 对象,也能够看成是 document 对象模型的父节点。作为全局对象被拜访。
window.screen
window 全局对象的一个属性,蕴含了物理屏幕的尺寸信息。
window.screen or just screen is a small information object about physical screen dimensions.
window.document
window.document or just document is the main object of the potentially visible (or better yet: rendered) document object model/DOM.
页面被渲染后的可见局部对应的 DOM 对象。
body
是上文形容的 document 对象中一个名为 body 的子节点。
Since window is the global object you can reference any properties of it with just the property name – so you do not have to write down window. – it will be figured out by the runtime.
因为 window 是全局对象,因而拜访其属性时,能够省略 window. 的写法。
因而通过下列形式拜访 window 里的属性,同样无效:
更多 Jerry 的原创文章,尽在:” 汪子熙 ”: