Element(元素)接口是 Document 的一个對象 (Object)。 它描述了所有同类元素,所普遍具有的「方法」和「属性」。
这些「继承」自 Element,并且增加了一些「额外功能」的接口,描述了更具体的行为。 例如, HTMLElement 接口是所有 HTML 元素的基础接口; 而 SVGElement 接口是所有 SVG 元素的基本接口。
在 web 以外的语言,像 XUL,通过 XULElement 的 API,也能实现它。
Element.clientWidthpadding;不含 scrollbar、border、margin。Element.clientLeftborder、scrollbar;不含 padding、margin。Element.scrollHeightpadding;不含 border 和 margin。scrollHeight 值 clientHeight 相同 (含 scrollbar? )。scrollHeight 也包括伪元素 e.g. ::before 和 ::after。Element.getBoundingClientRect().Element.scrollLeftdirection: rtl,scrollLeft 值为 0;當增加偏移量,是增加負值scrollLeft 數值)。HTMLElement 接口表示所有的 HTML 元素。
HTMLElement.offsetWidthwidth、border、padding、scrollbar。offsetWidth 可能有所不同。HTMLElement.offsetTopoffsetParent 元素的 top 偏移量。HTMLElement.offsetParentoffsetParent 为最近的 table 或 table cell
或「根元素(标准模式下为 html;quirks 模式下为 body)」。style.display 设置为 " none " 时,offsetParent 返回 null。
offsetParent 很有用,因为 offsetTop 和 offsetLeft 都相對其 padding。window 物件代表了一個包含 DOM 文件的視窗,
其中的 document 屬性指向了視窗中載入的 Document 物件。
而使用 document 的 defaultView 屬性,
則可取得該 Document 物件所在的視窗 window 物件。
window.innerWidthinnerWidth 属性被任一 window 物件支持,如 window、frame、frameset 或 secondary window。window.outerHeightwindow.pageYOffset、window.scrollYwindow.scrollY 的别名,返回文档在垂直方向「已滚动的像素值」。window.parent<iframe>、<object>、或者 <frame>,则它的父窗口是嵌入它的那个窗口。