lib/cssSelectorParser.js
function parseCSSSelector(selector) {
    const match = SELECTOR_RE.exec(selector);
    if (!match) {
        throw new Error("Unsupported or invalid CSS selector: " + selector);
    }
    const res = { nodeName: match[1].trim() };
    if (match[2]) {
        const attr = [match[2]];
        if (match[3]) { attr.push(match[3]); }
        // Decode the attribute value
        if(match[4]) {
            attr.push(match[4].replace(/\\([nrtf"\\])/g, function(_, k) {
                return valueDecodeTable[k];
            }));
        }
        res.attributes = [attr];
    }
    return res;
}
function parseCSSSelector(selector) {
    const match = SELECTOR_RE.exec(selector);
    if (!match) {
        throw new Error("Unsupported or invalid CSS selector: " + selector);
    }
    const res = { nodeName: match[1].trim() };
    if (match[2]) {
        const attr = [match[2]];
        if (match[3]) { attr.push(match[3]); }
        // Decode the attribute value
        if(match[4]) {
            attr.push(match[4].replace(/\\([nrtf"\\])/g, function(_, k) {
                return valueDecodeTable[k];
            }));
        }
        res.attributes = [attr];
    }
    return res;
}
function parseCSSSelector ( selector ) { const match = SELECTOR_RE . exec ( selector ) ; if ( ! match ) { throw new Error ( "Unsupported or invalid CSS selector: " + selector ) ; } const res = { nodeName : match [ 1 ] . trim ( ) } ; if ( match [ 2 ] ) { const attr = [ match [ 2 ] ] ; if ( match [ 3 ] ) { attr . push ( match [ 3 ] ) ; } // Decode the attribute value if ( match [ 4 ] ) { attr . push ( match [ 4 ] . replace ( / \\([nrtf"\\]) / g , function ( _ , k ) { return valueDecodeTable [ k ] ; } ) ) ; } res . attributes = [ attr ] ; } return res ; }
Simple CSS selector parser.

Limitations:
- Only supports single attribute selector.
Simple CSS selector parser .