w3c/csswg-drafts

[cssom-view] No browsers honor "the HTML body element" in `offsetTop`

Open

#584 opened on 2016年10月10日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)HTML (545 forks)batch import
Help Wantedcssom-view-1

Repository metrics

Stars
 (3,546 stars)
PR merge metrics
 (平均マージ 87d 7h) (30d で 24 merged PRs)

説明

https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsettop

If the element is the HTML body element or does not have any associated CSS layout box return zero and terminate this algorithm.

<html>
<body id=body></body>
<script>
var body = document.getElementById('body');
var innerBody = document.createElement('body');
body.appendChild(innerBody);
window.alert(innerBody.offsetTop);
window.alert(innerBody.offsetLeft);
</script>
</html>

At the time of writing, Safari, Chrome, and Firefox all output 0 and 0 for this.

コントリビューターガイド