javascript-tutorial / javascript-tutorial/en.javascript.info
Error description with element hidden check in "Element size and scrolling"
- 主要語言
- 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