在阅读了关于window.innerHeight
的MDN Article之后,我想在我的一些测试中使用<html>
元素clientHeight
属性,因为它是"the height of the window minus its horizontal scroll bar and any borders".
所以我需要引用<html>
元素.
在判断了Window对象和Document对象之后,获得该引用的唯一方法是查询DOM.例如:const htmlElement = document.getElementsByTagName("html")[0];
我想知道有没有更好的 Select ?也许是像document.htmlElement
这样简单的东西?