<commit_before>/*
---
 
script: Selectors.js
 
description: Define a widget associations
 
license: Public domain (http://unlicense.org).

authors: <NAME>
 
requires:
  - LSD.Module
  - Core/Slick.Finder

provides: 
  - LSD.Module.Selectors

...
*/

!function() {

LSD.Module.Selectors = new Class({
  getElements: function(selector, origin) {
    if (!selector.Slick) selector = Slick.parse(selector);
    var first = selector.expressions[0][0];
    // we have to figure the document before we do a .search
    if (!origin) switch (first.combinator) {
      case "$": case "$$":
        origin = this.element;
        break;
      case "&": case "&&": default:
        origin = this;
    }
    return Slick.search(origin, selector)
  },
  
  getElement: function(selector) {
    return Slick.find(this, selector)
  }
});

var Combinators = LSD.Module.Selectors.Combinators = {
  '$': function(node, tag, id, classes, attributes, pseudos) { //this element
    return this.push(node, tag, id, classes, attributes, pseudos)
  },

  '$$': function(node, tag, id, classes, attributes, pseudos) { //this element document
    if ((tag == '*') && !id && !classes && !attributes) return this.push(this.document.body);
    else return this['combinator: '](this.document.body, tag, id, classes, attributes, pseudos);
  }
};

Combinators['&'] = Combinators['$'];
Combinators['&&'] = Combinators['$$'];

for (name in Combinators) Slick.defineCombinator(name, Combinators[name])

LSD.Module.Selectors.Features = {
  brokenStarGEBTN: false,
  starSelectsClosedQSA: false,
  idGetsName: false,
  brokenMixedCaseQSA: false,
  brokenGEBCN: false,
  brokenCheckedQSA: false,
  brokenEmptyAttributeQSA: false,
  isHTMLDocument: false,
  nativeMatchesSelector: false,<commit_msg>Pass pseudos to document in $$<commit_after>/*
---
 
script: Selectors.js
 
description: Define a widget associations
 
license: Public domain (http://unlicense.org).

authors: <NAME>
 
requires:
  - LSD.Module
  - Core/Slick.Finder

provides: 
  - LSD.Module.Selectors

...
*/

!function() {

LSD.Module.Selectors = new Class({
  getElements: function(selector, origin) {
    if (!selector.Slick) selector = Slick.parse(selector);
    var first = selector.expressions[0][0];
    // we have to figure the document before we do a .search
    if (!origin) switch (first.combinator) {
      case "$": case "$$":
        origin = this.element;
        break;
      case "&": case "&&": default:
        origin = this;
    }
    return Slick.search(origin, selector)
  },
  
  getElement: function(selector) {
    return Slick.find(this, selector)
  }
});

var Combinators = LSD.Module.Selectors.Combinators = {
  '$': function(node, tag, id, classes, attributes, pseudos) { //this element
    return this.push(node, tag, id, classes, attributes, pseudos)
  },

  '$$': function(node, tag, id, classes, attributes, pseudos) { //this element document
    if ((tag == '*') && !id && !classes && !attributes) return this.push(this.document.body, null, null, null, null, pseudos);
    else return this['combinator: '](this.document.body, tag, id, classes, attributes, pseudos);
  }
};

Combinators['&'] = Combinators['$'];
Combinators['&&'] = Combinators['$$'];

for (name in Combinators) Slick.defineCombinator(name, Combinators[name])

LSD.Module.Selectors.Features = {
  brokenStarGEBTN: false,
  starSelectsClosedQSA: false,
  idGetsName: false,
  brokenMixedCaseQSA: false,
  brokenGEBCN: false,
  brokenCheckedQSA: false,
  brokenEmptyAttributeQSA: false,
  isHTMLDocument: false,
  nativeMatchesSelector: false,
{'fraction_non_alphanumeric': 0.15050448430493274, 'fraction_numerical': 0.0011210762331838565, 'mean_word_length': 3.7777777777777777, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 5, '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': '107667', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1157, 'n_words': 285}