1 This test checks if offsetParent is always null when accessed from the HTML <body> and from elements with CSS property position:fixed. To ensure values match layout, this test also checks offsetTop and offsetLeft.
3 In addition to the HTML <body>, two elements with CSS property position:fixed are tested: One within the body, and one within an element with CSS property position:absolute.
5 Finally, a static- and relative-positioned element are tested for sanity and spec adherence.
7 Expected values are parenthesized. Test has passed if all values match.
9 First Fixed offsetParent (null): null
11 First Fixed offsetTop (10): 10
13 First Fixed offsetLeft (20): 20
15 Second Fixed offsetParent (null): null
17 Second Fixed offsetTop (15): 15
19 Second Fixed offsetLeft (30): 30
21 Body offsetParent (null): null
25 Body offsetLeft (0): 0
27 Static offsetParent ([object HTMLBodyElement]): [object HTMLBodyElement]
29 Static offsetTop (15): 15
31 Static offsetLeft (15): 15
33 Relative offsetParent ([object HTMLBodyElement]): [object HTMLBodyElement]
35 Relative offsetTop (13): 13
37 Relative offsetLeft (19): 19