dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
105 stars 36 forks source link

Throw when repeated complex select #32

Closed pmdartus closed 4 years ago

pmdartus commented 4 years ago

Basic info:

Minimal reproduction case

Live example: jsbin

NW.Dom.install();
NW.Dom.select('.foo, .foo, .bar', document.body);  // pass
NW.Dom.select('.foo, .foo, .bar', document.body); // error

// nwsapi.js:1450 Uncaught TypeError: Cannot read property '0' of undefined
//    at Object._querySelectorAll [as select]

Observations

This is a real conner case, this issue only happens when there is a duplicate class selector and different class selector in a compound selector and when the selector runs multiple times. Context in the original issue.

dperini commented 4 years ago

@pmdartus thank you for reporting this issue. A quick look to line 1450 reveal there is an issue in the way I perform the needed check. So I confirm the problem you reported exists and will be fixed it as soon as work load allows. Appreciate your time to test and report the issue.

dperini commented 4 years ago

@pmdartus issue should be fixed, thank you for you help reporting.