dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
103 stars 35 forks source link

Pseudo-class `:is()` should not fail on empty arg or invalid selectors in arg #70

Closed slavaleleka closed 1 year ago

slavaleleka commented 1 year ago

Basic info:

Minimal reproduction case

describe('pseudo-class :is() ', () => {
    it('1: no arg', () => {
        const selector = 'div > *:is()';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    it('2: invalid arg', () => {
        const selector = 'div > *:is(1)';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    it('3: invalid arg', () => {
        const selector = 'div > *:is(id="123")';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });
});

All three cases are throwing error but should not since :is() takes forgiving-selector-list as argument so invalid selectors should be skipped with no error. Also no error is thrown when I check these selectors in browser

dperini commented 1 year ago

@slavaleleka None of the three cases you outlined above is throwing error using current release 2.2.3. So I believe this issue can be closed.