<commit_before>/*! matches.js v1.0.1 - <NAME> - MIT license */

;(function (global) {

'use strict';

/**
 * Vendor-specific implementations of `Element.prototype.matches()`
 */

var proto = Element.prototype;
var vendorMatches = proto.matches ||
    proto.mozMatchesSelector ||
    proto.msMatchesSelector ||
    proto.oMatchesSelector ||
    proto.webkitMatchesSelector;

/**
 * Determine if a DOM element matches a CSS selector
 *
 * @param {Element} elem
 * @param {String} selector
 * @return {Boolean}
 * @api public
 */

function matches(elem, selector) {
    if (vendorMatches) {
        return vendorMatches.call(elem, selector);
    }

    var elemParent = elem.parentNode;
    var nodes;
    var i;

    // if the element has no parent, append it to a documentFragment
    if (!elemParent) {
        elemParent = document.createDocumentFragment();
        elemParent.appendChild(elem);
    }

    // from the parent element's context, get all nodes that match the selector
    nodes = elemParent.querySelectorAll(selector);<commit_msg>Fix `matches()` for orphan elements in IE 9<commit_after>/*! matches.js v1.0.1 - <NAME> - MIT license */

;(function (global) {

'use strict';

/**
 * Vendor-specific implementations of `Element.prototype.matches()`
 */

var proto = Element.prototype;
var vendorMatches = proto.matches ||
    proto.mozMatchesSelector ||
    proto.msMatchesSelector ||
    proto.oMatchesSelector ||
    proto.webkitMatchesSelector;

/**
 * Determine if a DOM element matches a CSS selector
 *
 * @param {Element} elem
 * @param {String} selector
 * @return {Boolean}
 * @api public
 */

function matches(elem, selector) {
    var elemParent = elem.parentNode;
    var nodes;
    var i;

    // if the element has no parent, append it to a documentFragment
    // required for IE 9's prefixed implementation of `matches()` and the fallback
    if (!elemParent) {
        elemParent = document.createDocumentFragment();
        elemParent.appendChild(elem);
    }

    if (vendorMatches) {
        return vendorMatches.call(elem, selector);
    }

    // from the parent element's context, get all nodes that match the selector
    nodes = elemParent.querySelectorAll(selector);
{'fraction_non_alphanumeric': 0.11292517006802721, 'fraction_numerical': 0.0036281179138321997, 'mean_word_length': 3.2751937984496124, 'pattern_counts': {'":': 0, '<': 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': '2695623', 'n_tokens_mistral': 637, 'n_tokens_neox': 618, 'n_words': 193}