Sha256: e801651ceafa377d7c7d7419cec6319cd68069e0e8cc724f1a69e76a28d3d915

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

if (typeof Sizzle.selectors.pseudos.regexp == 'undefined') {
  Sizzle.selectors.pseudos.regexp =
    Sizzle.selectors.createPseudo(function(selector) {
      var selectors = selector.match(/^([^,]+), (.+)$/);
      var attr = selectors[1];
      var flags = selectors[2].replace(/.*\/([gimy]*)$/, '$1');
      var pattern = selectors[2].replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');
      var regexp = new RegExp(pattern, flags);
      return function(el) {
        switch (attr) {
          case "text":
            var value = el.textContent;
            break;
          case "href":
            var value = el.getAttribute('href');
            if (value) {
              value = value.replace(/^\s+|\s+$/g, ''); // strip spaces
            }
            break;
          default:
            var value = el.getAttribute(attr);
       }
       return regexp.test(value);
      }
    });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watizzle-0.1.0 lib/watizzle/sizzle/regexp.pseudo.js