mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge pull request #896 from atom/bo-is-visible-is-evil
Speed up pane swapping -- isVisible() is slow
This commit is contained in:
@@ -1175,7 +1175,7 @@ class Editor extends View
|
||||
updateDisplay: (options={}) ->
|
||||
return unless @attached and @activeEditSession
|
||||
return if @activeEditSession.destroyed
|
||||
unless @isVisible()
|
||||
unless @isOnDom() and @isVisible()
|
||||
@redrawOnReattach = true
|
||||
return
|
||||
|
||||
|
||||
@@ -35,7 +35,21 @@ $.fn.isOnDom = ->
|
||||
@closest(document.body).length is 1
|
||||
|
||||
$.fn.isVisible = ->
|
||||
@is(':visible')
|
||||
!@isHidden()
|
||||
|
||||
$.fn.isHidden = ->
|
||||
# Implementation taken from jQuery's `:hidden` expression code:
|
||||
# https://github.com/jquery/jquery/blob/master/src/css/hiddenVisibleSelectors.js
|
||||
#
|
||||
# We were using a pseudo selector: @is(':hidden'). But jQuery's pseudo
|
||||
# selector code checks the element's webkitMatchesSelector, which is always
|
||||
# false, and is really really really slow.
|
||||
|
||||
elem = this[0]
|
||||
|
||||
return null unless elem
|
||||
|
||||
elem.offsetWidth <= 0 and elem.offsetHeight <= 0
|
||||
|
||||
$.fn.isDisabled = ->
|
||||
!!@attr('disabled')
|
||||
|
||||
Reference in New Issue
Block a user