Skip to content

When no parent has been found that matches the selector the library throws an error #8

@TomCaserta

Description

@TomCaserta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions