<commit_before>###
Utility class that may host checks
for bound event handlers on elements
as that feature is currenty a wontfix
@see http://bugs.jquery.com/ticket/11945
###
class HasEvent
  ###
  Internal

  @param $el [Object] The jQuery element on which
  the check will be performed
  @param type [String] Event type such as 'click', 'focus', etc.
  @param selector [String|Object] The selector defined for event delegation
  @param handler [Function] The expected event handler
  @return [Boolean] True when the given handler is bound
  to the given element on the given event type
  ###
  @_performCheck: ($el, type, selector, handler, is_global) ->
    # jQuery internally keeps in the cache the events bound on each
    # element. We perform a search in the cache manually to avoid
    # known api inconsistencies ($._data() and $(el).data()) between versions

    # Perform a different check when the target is the window|document object
    if is_global
      data = $._data($el)
    else
      return false if $el.length is 0
      data = $._data($el[0])

    if data?.events?[type]?
      for v in data.events[type]
        if v.handler is handler
          return true

    return false

  ###
  Tests if the supplied event is bound on the supplied
  element optionally delegated to the supplied selector
  and is handled bu the supplied handler

  usage: .check(event, type [, selector], handler)

  @param $el [Object] The jQuery element on which
  the check will be performed
  @param type [String] Event type such as 'click', 'focus', etc.
  @param selector [String] (optional) The selector defined for event delegation
  @param handler [Function] The expected event handler
  @return [Boolean] True when the given handler is bound
  to the given element on the given event type
  @see http://robflaherty.github.io/jquery-annotated-source/docs/07-event.html#section-38
  ###
  @check: ($el, type, selector, handler) -><commit_msg>Fix usage example for 'check' method to be compatible with params<commit_after>###
Utility class that may host checks
for bound event handlers on elements
as that feature is currenty a wontfix
@see http://bugs.jquery.com/ticket/11945
###
class HasEvent
  ###
  Internal

  @param $el [Object] The jQuery element on which
  the check will be performed
  @param type [String] Event type such as 'click', 'focus', etc.
  @param selector [String|Object] The selector defined for event delegation
  @param handler [Function] The expected event handler
  @return [Boolean] True when the given handler is bound
  to the given element on the given event type
  ###
  @_performCheck: ($el, type, selector, handler, is_global) ->
    # jQuery internally keeps in the cache the events bound on each
    # element. We perform a search in the cache manually to avoid
    # known api inconsistencies ($._data() and $(el).data()) between versions

    # Perform a different check when the target is the window|document object
    if is_global
      data = $._data($el)
    else
      return false if $el.length is 0
      data = $._data($el[0])

    if data?.events?[type]?
      for v in data.events[type]
        if v.handler is handler
          return true

    return false

  ###
  Tests if the supplied event is bound on the supplied
  element optionally delegated to the supplied selector
  and is handled bu the supplied handler

  usage: .check($el, type [, selector], handler)

  @param $el [Object] The jQuery element on which
  the check will be performed
  @param type [String] Event type such as 'click', 'focus', etc.
  @param selector [String] (optional) The selector defined for event delegation
  @param handler [Function] The expected event handler
  @return [Boolean] True when the given handler is bound
  to the given element on the given event type
  @see http://robflaherty.github.io/jquery-annotated-source/docs/07-event.html#section-38
  ###
  @check: ($el, type, selector, handler) ->
{'fraction_non_alphanumeric': 0.08544624746450304, 'fraction_numerical': 0.005578093306288032, 'mean_word_length': 3.550173010380623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6498851', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1054, 'n_words': 510}