Open
Description
Describe the bug
I'm testing a UI component which has a stimulus controller attached to it. The same test works with jsdom but fails with happy-dom. The controller itself is connected but the targets are not connected.
To Reproduce
Steps to reproduce the behavior:
Try to render a component which uses Stimulus.js controllers
render(
<div>
<form data-controller="newtripsearchform">
<div data-newtripsearchform-target="foo">Bar</div>
</form>
</div>,
);
Stimulus Controller
class SomeClass extends Controller {
static targets = ["foo"];
connect(): void {
// Working
console.log("Connected !!");
}
fooTargetConnected() {
// Not working with happy-dom, only works with jsdom
console.log("Round trip radio input connected");
}
}
Since Stimulus is heavily dependent on MutationObserver API, is it because of the way happy-dom's MutationObserver API is implemented ?
https://stimulus.hotwired.dev/reference/lifecycle-callbacks#order-and-timing
Device:
- OS: Ubuntu
- Stack: Remix, Hotwire Stimulus, Hotwire Turbo, Vite