0
所以我正在瀏覽一些較老的jQuery發行說明,並發現這一點。爲什麼執行速度更快:使用offsetWidth和offsetHeight隱藏?
This is how the logic has changed:
* In jQuery 1.3.1 (and older) an element was visible if its CSS 「display」 was not 「none」, its CSS 「visibility」 was not 「hidden」, and its type (if it was an input) was not 「hidden」.
* In jQuery 1.3.2 an element is visible if its browser-reported offsetWidth or offsetHeight is greater than 0.
在發行說明中,他們出於性能原因做了這些。
爲什麼要以這種方式改變實現會帶來這樣的性能好處?
你可以看到
http://blog.jquery.com/2009/02/20/jquery-1-3-2-released/