Google Chrome のバグっぽいもの

2020年2月9日ソフトウェア,コンピュータ関係

Google Chrome 0.2.149.29 、JavaScript の表示領域取得がうまくできません。


document.documentElement.scrollHeight8
document.documentElement.clientHeight500
document.documentElement.scrollWidth700
document.documentElement.clientWidth700

※HTML 4.01 Strict

document.documentElement.scrollHeight はブラウザの表示領域の高さをスクロールバー分込みで取得するものですが「8」ってどこから!?「0」ならともかく。
scrollWidth は正しく取得できるのでバグでしょう。

とりあえず↓でしのげます。
IE, Firefox, Opera, Google Chrome で動作確認済。

var H = ( document.documentElement.clientHeight || document.documentElement.scrollHeight ) ;