mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Shortcut out of isHidden when we can.
Checking computed style is an order of magnitude more expensive than checking the style property.
This commit is contained in:
@@ -40,7 +40,14 @@ $.fn.isVisible = ->
|
||||
$.fn.isHidden = ->
|
||||
# We used to check @is(':hidden'). But this is much faster than the
|
||||
# offsetWidth/offsetHeight check + all the pseudo selector mess in jquery.
|
||||
@css('display') == 'none'
|
||||
style = this[0].style
|
||||
|
||||
if style.display == 'none' or not @isOnDom()
|
||||
true
|
||||
else if style.display
|
||||
false
|
||||
else
|
||||
getComputedStyle(this[0]).display == 'none'
|
||||
|
||||
$.fn.isDisabled = ->
|
||||
!!@attr('disabled')
|
||||
|
||||
Reference in New Issue
Block a user