🐛 bug report
Preflight Checklist
Description of the problem
The class hierarchy for elements is broken.
EventTarget -> Node -> Element -> HTMLElement -> HTMLButtonElement
How has this issue affected you? What are you trying to accomplish?
Using an element as a parameter to e.g. Range.setStart results in TypeError: Failed to execute 'setStart' on 'Range': parameter 1 is not of type 'Node'.
Codesandbox is our primary platform for online reproduction at @testing-library/user-event.
user-event@14 supports Selection. With this bug all pointer interactions with elements that don't implement their own selection (everything except <input>,<textarea>) result in an error.
To Reproduce
test('Element extends Node', () => {
expect(document.body).toBeInstanceOf(Node) // fails
})
test('select per Range', () => {
document.body.innerHTML = `<div>foo</div>`
const range = new Range()
range.setStart(document.body.firstChild, 0) // throws
range.setEnd(document.body.firstChild, 1)
document.getSelection().addRange(range)
})
Link to sandbox: link (optional)
Your Environment
| Software |
Name/Version |
| Сodesandbox |
|
| Browser |
Chrome 99.0.4844.82 |
| Operating System |
Ubuntu 20.04.4 LTS |
🐛 bug report
Preflight Checklist
adheres to.
to file, without success.
Description of the problem
The class hierarchy for elements is broken.
How has this issue affected you? What are you trying to accomplish?
Using an element as a parameter to e.g.
Range.setStartresults inTypeError: Failed to execute 'setStart' on 'Range': parameter 1 is not of type 'Node'.Codesandbox is our primary platform for online reproduction at @testing-library/user-event.
user-event@14supports Selection. With this bug all pointer interactions with elements that don't implement their own selection (everything except<input>,<textarea>) result in an error.To Reproduce
Link to sandbox: link (optional)
Your Environment