<commit_before>"use strict";

var expect = require("expect.js"),
    DomUtils = require("htmlparser2").DomUtils,
    helper = require("../helper.js"),
    document = helper.getDOM(require("fs").readFileSync(__dirname + "/index.html") + ""),
    CSSselect = helper.CSSselect;

var location = { hash: "" };
CSSselect.filters.target = function(next) {
    return function(elem) {
        return elem.attribs && elem.attribs.id === location.hash.substr(1);
    };
};

//---

/*
	The following is taken from https://github.com/ded/qwery/blob/master/tests/tests.js
*/

CSSselect.pseudos.humanoid = function(e, v) {
    return CSSselect.is(e, "li:contains(human)") || CSSselect.is(e, "ol:contains(human)");
};

var frag = helper.getDOM(
    '<div class="d i v">' +
        '<p id="oooo"><em></em><em id="emem"></em></p>' +
        "</div>" +
        '<p id="sep">' +
        '<div class="a"><span></span></div>' +
        "</p>"
);

var doc = helper.getDOM(
    '<div id="hsoob">' +
        '<div class="a b">' +
        '<div class="d e sib" test="fg" id="booshTest"><p><span id="spanny"></span></p></div>' +<commit_msg>implement :target as pseudo (not filter)<commit_after>"use strict";

var expect = require("expect.js"),
    DomUtils = require("htmlparser2").DomUtils,
    helper = require("../helper.js"),
    document = helper.getDOM(require("fs").readFileSync(__dirname + "/index.html") + ""),
    CSSselect = helper.CSSselect;

var location = { hash: "" };
CSSselect.pseudos.target = function(elem) {
    return elem.attribs && elem.attribs.id === location.hash.substr(1);
};

//---

/*
	The following is taken from https://github.com/ded/qwery/blob/master/tests/tests.js
*/

CSSselect.pseudos.humanoid = function(e, v) {
    return CSSselect.is(e, "li:contains(human)") || CSSselect.is(e, "ol:contains(human)");
};

var frag = helper.getDOM(
    '<div class="d i v">' +
        '<p id="oooo"><em></em><em id="emem"></em></p>' +
        "</div>" +
        '<p id="sep">' +
        '<div class="a"><span></span></div>' +
        "</p>"
);

var doc = helper.getDOM(
    '<div id="hsoob">' +
        '<div class="a b">' +
        '<div class="d e sib" test="fg" id="booshTest"><p><span id="spanny"></span></p></div>' +
{'fraction_non_alphanumeric': 0.23104693140794225, 'fraction_numerical': 0.0018050541516245488, 'mean_word_length': 3.2634615384615384, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 2, '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': '4783545', 'n_tokens_mistral': 774, 'n_tokens_neox': 786, 'n_words': 143}