Skip to content

fix: prevent identifier extraction as event names, support custom Event classes#330

Open
binlabs wants to merge 1 commit into
open-wc:masterfrom
binlabs:fix/event-class-names
Open

fix: prevent identifier extraction as event names, support custom Event classes#330
binlabs wants to merge 1 commit into
open-wc:masterfrom
binlabs:fix/event-class-names

Conversation

@binlabs
Copy link
Copy Markdown

@binlabs binlabs commented Jan 17, 2026

Fixes #149

  1. The analyzer incorrectly extracted identifiers as event names when dispatching custom event classes (e.g., extracting "someArg" from new MyEvent(someArg)).
  2. Now parses custom Event class constructors to extract the actual event name from the super() call.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 17, 2026

Deploy Preview for custom-elements-manifest-analyzer ready!

Name Link
🔨 Latest commit c378343
🔍 Latest deploy log https://app.netlify.com/projects/custom-elements-manifest-analyzer/deploys/696c7fcee8b7ab00089170ff
😎 Deploy Preview https://deploy-preview-330--custom-elements-manifest-analyzer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@binlabs binlabs force-pushed the fix/event-class-names branch from 0418b54 to a744989 Compare January 18, 2026 06:28
@binlabs binlabs force-pushed the fix/event-class-names branch from a744989 to c378343 Compare January 18, 2026 06:38
@binlabs
Copy link
Copy Markdown
Author

binlabs commented Jan 18, 2026

I just realized that naming these fixtures "custom-event" may have been confusing, because they are really subclasses of either Event or CustomEvent.

So I just renamed the fixtures and amended the commit, just FYI.

@web-padawan
Copy link
Copy Markdown

We have also noticed this issue with the incorrect eventName extraction as event name in the following code:

  __dispatchCustomEvent(eventName, item, value) {
    if (!item) {
      return;
    }
    this.dispatchEvent(
      new CustomEvent(eventName, {
        detail: {
          item,
          value,
        },
      }),
    );
  }

IMO it would be good to get this fix merged, maybe it would help to split into 2 PRs. @thepassle WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: incorrect event names when using custom event classes

2 participants