Sha256: e53da15e983a2a51f2bd310874b6e3ab3d4a768a7ca589c484b1331689cb280e

Contents?: true

Size: 929 Bytes

Versions: 11

Compression:

Stored size: 929 Bytes

Contents

u = up.util
e = up.element
$ = jQuery

up.specUtil = do ->

  ###**
  Returns whether the given element has been detached from the DOM
  (or whether it was never attached).

  @function up.util.isDetached
  @internal
  ###
  isDetached = (element) ->
    element = e.get(element)
    # This is by far the fastest way to do this
    not $.contains(document.documentElement, element)

  isAttached = (element) ->
    !isDetached(element)

  isVisible = (element) ->
    $(element).is(':visible')

  isHidden = (element) ->
    $(element).is(':hidden')

  ###**
  @function up.util.promiseTimer
  @internal
  ###
  promiseTimer = (ms) ->
    timeout = undefined
    promise = new Promise (resolve, reject) ->
      timeout = u.timer(ms, resolve)
    promise.cancel = -> clearTimeout(timeout)
    promise


  isDetached: isDetached
  isAttached: isAttached
  isVisible: isVisible
  isHidden: isHidden
  promiseTimer: promiseTimer



Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-1.0.1 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-1.0.0 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.62.1 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.62.0 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.61.1 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.61.0 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.60.3 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.60.2 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.60.1 spec_app/spec/javascripts/helpers/spec_util.coffee
unpoly-rails-0.60.0 spec_app/spec/javascripts/helpers/spec_util.coffee