CSSOM View Module compliance: offsetParent attribute implementation

1st test: offsetParent of root element

If nodeA is the root element, then nodeA.offsetParent returns null.

 

 

2nd test: offsetParent of HTML body element

If nodeA is the HTML body element, then nodeA.offsetParent returns null.

 

 

3rd test: offsetParent of nodeA when nodeA is a position: fixed element

If the computed value of the position property for nodeA is fixed, then nodeA.offsetParent returns null.

 

 

4th test: offsetParent of nodeA when nodeA is an <area> element within a <map>

If nodeA is an area HTML element which has a map HTML element somewhere in the ancestor chain, then nodeA.offsetParent returns null because the map element does not have an associated CSS layout box.

 

 

Long-tailed weasel Eastern gray squirrel Red cardinal Wild rabbit

5th test: nearest non-static-positioned ancestor of nodeA

If the computed value of the position property of the nearest ancestor of nodeA is not static, then nodeA.offsetParent returns such ancestor.

 

 

6th test: when nearest ancestors of nodeA are static-positioned and not table elements, then nodeA.offsetParent is the HTML body element.

If nodeA's ancestors are not td HTML element, not th HTML element, not table HTML element and nodeA's ancestors within the containment hierarchy are all position static and nodeA is within the document containment hierarchy, then nodeA.offsetParent return [object HTMLBodyElement].

 

 

7th test: when an ancestor of nodeA is a td HTML element

If an ancestor of nodeA is the td HTML element, then nodeA.offsetParent returns [object HTMLTableCellElement].

<td><p id="PInsideTD">Hello</p></td>

 

 

8th test: when an ancestor of nodeA is a th HTML element

If an ancestor of nodeA is the th HTML element, then nodeA.offsetParent returns [object HTMLTableCellElement].

<th><p id="PInsideTH">Hello</p></th>

 

 

9th test: when an ancestor of nodeA is a table HTML element

If an ancestor of nodeA is the table HTML element, then nodeA.offsetParent returns [object HTMLTableElement].

Hello

 

 

 

Browser results when querying offsetParent attribute
IE 7 IE 8 RC1 Firefox 2 Firefox 3 Opera 9.50 Safari 3.1.1 Konq 4.1.2
IE 7 IE 8 RC1 Firefox 2 Firefox 3 Opera 9.50 Safari 3.1.1 Konq 4.1.2
1st test Passes Passes Passes Passes Passes Passes Passes
2nd test Passes Passes Passes Passes Passes Passes Passes
3rd test Passes Passes Fails Fails Passes Fails Passes
4th test Fails Passes Fails Fails Fails Fails Fails
5th test Passes Passes Passes Passes Passes Passes Passes
6th test Passes Passes Passes Passes Passes Passes Passes
7th test Passes Passes Passes Passes Passes Passes Passes
8th test Passes Passes Passes Passes Passes Passes Passes
9th test Passes Passes Passes Passes Passes Passes Passes

Valid HTML 4.01! Valid CSS!