When no parent has been found that matches the selector the library throws an error
TomCaserta opened this issue · 2 comments
TomCaserta commented
Given the following test code:
const rootComponent = createTestComponent(parent, {
childClassName: 'boo',
})
const testSubComponent = querySelectorDeep('.hello-world .boo', rootComponent);
expect(testSubComponent).toBeNull();
The findMatchingElement
will throw the error TypeError: parent.matches is not a function
.
This is because it finds the test component matching .boo
and traverses up to find a parent that matches .hello-world
. As no element matches this selector it'l continue to traverse up until it hits the document element that has no method named matches
.
Georgegriff commented
Thanks for the issue and PR I'll take a look as soon as I can :)
Georgegriff commented
New release is available with this fix: https://github.com/Georgegriff/query-selector-shadow-dom/releases/tag/0.3.3 @TomCaserta