w3c/csswg-drafts

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

Open

#584 aperta il 10 ott 2016

Vedi su GitHub
 (7 commenti) (0 reazioni) (0 assegnatari)HTML (545 fork)batch import
Help Wantedcssom-view-1

Metriche repository

Star
 (3546 star)
Metriche merge PR
 (Merge medio 87g 7h) (24 PR mergiate in 30 g)

Descrizione

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.

Guida contributor