<commit_before># Role.js, jQuery adapter v1.0.1 ~ https://github.com/kossnocorp/role

do ($ = jQuery) ->

  $.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/

  $.expr.preFilter['ROLE'] = (match) -> ' ' + match[1] + ' '

  $.expr.filter['ROLE'] = (el, match) -> " #{ el.getAttribute('role') } ".indexOf(match) != -1

  for type of $.expr.match
    $.expr.match[type] = new RegExp( $.expr.match[type].source + (/(?![^\[]*\])(?![^\(]*\))/.source) )
    $.expr.leftMatch[type] = new RegExp(
      /(^(?:.|\r|\n)*?)/.source +
      $.expr.match[type].source.replace(
        /\\(\d+)/g
        (all, num) -> "\\" + (num - 0 + 1)
      )
    )

  # Monkey patch for `$.find.matchesSelector`
  #
  # Usage of Element.mozMatchesSelector was been cause of bugs in Firefox 3.6
  # https://developer.mozilla.org/en/DOM/Node.mozMatchesSelector
  #
  # Related issue: https://github.com/kossnocorp/role/issues/8
  if not document.documentElement.matchesSelector? and document.documentElement.mozMatchesSelector?
    matchesSelectorOrigin = $.find.matchesSelector
    $.find.matchesSelector = (node, expr) ->
      matchesSelectorOrigin(
        node
        expr.replace(
          /(@[\w\-]+)/g
          ($0) -> $0.replace( /^@([\w\-]+)$/, (__, $1) -> "[role~=\"#{$1}\"]" )<commit_msg>Fix problem with IE8 (closes #11)<commit_after># Role.js, jQuery adapter v1.0.1 ~ https://github.com/kossnocorp/role

do ($ = jQuery) ->

  $.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/

  $.expr.preFilter['ROLE'] = (match) -> ' ' + match[1] + ' '

  $.expr.filter['ROLE'] = (el, match) ->
    el.getAttribute? and " #{el.getAttribute('role')} ".indexOf(match) != -1

  for type of $.expr.match
    $.expr.match[type] = new RegExp( $.expr.match[type].source + (/(?![^\[]*\])(?![^\(]*\))/.source) )
    $.expr.leftMatch[type] = new RegExp(
      /(^(?:.|\r|\n)*?)/.source +
      $.expr.match[type].source.replace(
        /\\(\d+)/g
        (all, num) -> "\\" + (num - 0 + 1)
      )
    )

  # Monkey patch for `$.find.matchesSelector`
  #
  # Usage of Element.mozMatchesSelector was been cause of bugs in Firefox 3.6
  # https://developer.mozilla.org/en/DOM/Node.mozMatchesSelector
  #
  # Related issue: https://github.com/kossnocorp/role/issues/8
  if not document.documentElement.matchesSelector? and document.documentElement.mozMatchesSelector?
    matchesSelectorOrigin = $.find.matchesSelector
    $.find.matchesSelector = (node, expr) ->
      matchesSelectorOrigin(
        node
        expr.replace(
          /(@[\w\-]+)/g
          ($0) -> $0.replace( /^@([\w\-]+)$/, (__, $1) -> "[role~=\"#{$1}\"]" )
{'fraction_non_alphanumeric': 0.24050632911392406, 'fraction_numerical': 0.014192558496355964, 'mean_word_length': 2.6272600834492352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 6, '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': '6164022', 'n_tokens_mistral': 965, 'n_tokens_neox': 937, 'n_words': 161}