Skip to content

bug: TypeError: el.addEventListener is not a function in Stencil Core #6269

@joseabernardes

Description

@joseabernardes

Prerequisites

Stencil Version

4.31.0

Current Behavior

We're experiencing an issue while running unit tests for scoped component that have a <slot> element and a onSlotchange listener attached to it.

Image

Expected Behavior

No runtime error.

System Info

System: node 22.14.0
Platform: darwin (24.5.0)
CPU Model: Apple M3 Max (14 cpus)
Compiler: .../node_modules/@stencil/core/compiler/stencil.js
Build: 1746556979
Stencil: 4.31.0 🐁
TypeScript: 5.5.4
Rollup: 4.34.9
Parse5: 7.2.1
jQuery: 4.0.0-pre
Terser: 5.37.0

Steps to Reproduce

  1. Open the reproduction project
  2. npm install
  3. npm test

Code Reproduction URL

https://github.com/joseabernardes/stenciljs-issue.

Additional Information

  • Removing the onSlotchange listener makes the issue not happening;
  • We have the experimentalSlotFixes flag set to true. Toggling it to false did not resolve the issue.

Metadata

Metadata

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