angular/integration/ng_elements/src
Doug Parker cf47eb41ff test: use strict mode for ng_elements integration test
Apparently the Rollup bundle for these tests defaults to `es` format, meaning it expects to be loaded at runtime as native ESM. This was not happening because it was loaded as a regular `<script src="...">` tag (note the lack of `type="module"`).

This is problematic because Rollup assumed it would be running in a scoped environment, meaning [this function](adb8d1078d/packages/core/primitives/event-dispatch/src/event.ts (L45)), which happens to be named `addEventListener` but does *not* implement the `EventTarget.prototype.addEventListener` contract, was being bundled as a simple:

```javascript
function addEventListener(element, ...) {
  // ...
}
```

Since this was loaded with no `type="module"` or `'use strict';`, the script executed in "sloppy mode", meaning all `var` statements and function definitions are implicitly global. Since `window` *is* the `globalThis` object, this random `addEventListener` function clobbers the actual `window.addEventListener` and breaks any calls to it because they're not implementing the same contract.

Fix is to just use `<script src="..." type="module">`. Alternatively we could bundle in an IIFE, which Rollup does support, but in theory we could depend on external ES modules which aren't bundled, so the `type="module"` seems a little safer and more future-proof.
2026-04-13 14:12:48 +03:00
..
app.ts refactor: apply prettier formatting to integration (#54653) 2024-04-02 20:42:04 +00:00
elements.ts ci: reformat files 2025-12-16 14:44:19 -08:00
hello-world.html test: use strict mode for ng_elements integration test 2026-04-13 14:12:48 +03:00
main.ts test: update ng_elements integration test to run with APF v13 (#43431) 2021-10-01 18:28:46 +00:00
slots.html test: use strict mode for ng_elements integration test 2026-04-13 14:12:48 +03:00