Here's a minimal repro
import { JSDOM } from 'jsdom';
describe('nwsapi', () => {
it('should find the target', () => {
const doc = new JSDOM(`
<div>
<div class="neighbor"></div>
<div>
<a>
<img class="target"></img>
</a>
</div>
</div>
`).window.document;
const plusDiv = doc.querySelector('.neighbor + div .target');
const plusStar = doc.querySelector('.neighbor + * .target');
assert.ok(plusDiv, '+ div should match');
assert.ok(plusStar, '+ * should also match'); // fails
});
});
I traced the regression to 3d8f8d2 and more specifically to this area of the code:
case '~':
source = 'var N' + k + '=e;while(e&&(e=e.previousElementSibling)){' + source + '}e=N' + k + ';';
case '+':
source = 'var N' + k + '=e;if(e&&(e=e.previousElementSibling)){' + source + '}e=N' + k + ';';
case '\x20':
source = 'var N' + k + '=e;while(e&&(e=e.parentElement)){' + source + '}e=N' + k + ';';
In the commit, the restoration of e after branch traversal was dropped.
Here's a minimal repro
I traced the regression to 3d8f8d2 and more specifically to this area of the code:
In the commit, the restoration of
eafter branch traversal was dropped.