src/jsdom.js
function findAll(window, sels) {
    const document = window.document;

    // Unwrap noscript elements.
    const elements = document.getElementsByTagName('noscript');
    Array.prototype.forEach.call(elements, (ns) => {
        const wrapper = document.createElement('div');
        wrapper.innerHTML = ns.textContent;
        // Insert each child of the <noscript> as its sibling
        Array.prototype.forEach.call(wrapper.children, (child) => {
            ns.parentNode.insertBefore(child, ns);
        });
    });

    // Do the filtering.
    return sels.filter((selector) => {
        try {
            return document.querySelector(selector);
        } catch (e) {
            return true;
        }
    });
}
function findAll(window, sels) {
    const document = window.document;

    // Unwrap noscript elements.
    const elements = document.getElementsByTagName('noscript');
    Array.prototype.forEach.call(elements, (ns) => {
        const wrapper = document.createElement('div');
        wrapper.innerHTML = ns.textContent;
        // Insert each child of the <noscript> as its sibling
        Array.prototype.forEach.call(wrapper.children, (child) => {
            ns.parentNode.insertBefore(child, ns);
        });
    });

    // Do the filtering.
    return sels.filter((selector) => {
        try {
            return document.querySelector(selector);
        } catch (e) {
            return true;
        }
    });
}
function findAll ( window , sels ) { const document = window . document ; // Unwrap noscript elements. const elements = document . getElementsByTagName ( 'noscript' ) ; Array . prototype . forEach . call ( elements , ( ns ) => { const wrapper = document . createElement ( 'div' ) ; wrapper . innerHTML = ns . textContent ; // Insert each child of the <noscript> as its sibling Array . prototype . forEach . call ( wrapper . children , ( child ) => { ns . parentNode . insertBefore ( child , ns ) ; } ) ; } ) ; // Do the filtering. return sels . filter ( ( selector ) => { try { return document . querySelector ( selector ) ; } catch ( e ) { return true ; } } ) ; }
Filter unused selectors.
@param  {Object}  window A jsdom window
@param  {Array}   sels   List of selectors to be filtered
@return {Array}
Filter unused selectors .