Sha256: 736bd9074a4ae5df22edcaa3da3f275a49ee613af24fb51bcc2d36090ef59807

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

// Role.js, jQuery adapter v1.0.2 ~ https://github.com/kossnocorp/role

(function($) {
  var matchesSelectorOrigin, type;
  if ($ == null) $ = jQuery;
  $.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/;
  $.expr.preFilter['ROLE'] = function(match) {
    return ' ' + match[1] + ' ';
  };
  $.expr.filter['ROLE'] = function(el, match) {
    return (el.getAttribute != null) && (" " + (el.getAttribute('role')) + " ").indexOf(match) !== -1;
  };
  for (type in $.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, function(all, num) {
      return "\\" + (num - 0 + 1);
    }));
  }
  if (!(document.documentElement.matchesSelector != null) && (document.documentElement.mozMatchesSelector != null)) {
    matchesSelectorOrigin = $.find.matchesSelector;
    return $.find.matchesSelector = function(node, expr) {
      return matchesSelectorOrigin(node, expr.replace(/(@[\w\-]+)/g, function($0) {
        return $0.replace(/^@([\w\-]+)$/, function(__, $1) {
          return "[role~=\"" + $1 + "\"]";
        });
      }));
    };
  }
})($);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
role-rails-1.2.0 vendor/role/lib/jquery.role.js