javascript-tutorial / javascript-tutorial/en.javascript.info

Error description with element hidden check in "Element size and scrolling"

オープン
#1,955 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
tell your opinion
主要言語
HTML
スター
25.5k
フォーク
4k
PR マージ指標
30日以内にマージされた PR はありません

説明

The tutorial said:

> Geometry properties are calculated only for displayed elements.
>
> If an element (or any of its ancestors) has display:none or is not in the document, then all geometry properties are zero (or null for offsetParent).
>
> For example, offsetParent is null, and offsetWidth, offsetHeight are 0 when we created an element, but haven’t inserted it into the document yet, or it (or it’s ancestor) has display:none.
>
> We can use this to check if an element is hidden, like this:
>
> ```js
> function isHidden(elem) {
> return !elem.offsetWidth && !elem.offsetHeight;
> }
> ```

But, what if the hidden element is hidden by setting the `width` to `0`, not the `height`? 😀

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

「要素のサイズとスクロール」チュートリアルセクションから始め、引用されているジオメトリプロパティの説明と isHidden の例を確認してください。要素の幅がゼロの場合に例がどのように動作するかを明確にし、完成したテキストで非表示要素のチェックが正確に説明されるようにしてください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。