Skip to content

Is NavigateEvent meant to be user constructable? #11090

@rschristian

Description

@rschristian

What is the issue with the HTML Standard?

Disclaimer: I'm not the most familiar with these specs, at most I dabble.

I've been playing around with the new Navigation API and by chance I tried to manually create a NavigateEvent in a test suite only to find it seemingly cannot be created, despite having a constructor, as the NavigationDestination interface cannot be satisfied. E.g.,

new NavigateEvent('navigate', { destination: { ... } });

Uncaught TypeError: Failed to construct 'NavigateEvent': Failed to read the 'destination' property from 'NavigateEventInit': Failed to convert value to 'NavigationDestination'.

As far as I can tell there's no way to satisfy the NavigationDestination interface, not by supplying all attributes or only a subset, nor can it be omitted as the destination field is a required member.

So a few possibilities, as I see them:

  1. Users aren't meant to be able to form a NavigateEvent, in which case, should it have a constructor?
  2. NavigationDestination should have a constructor but does not.

I should add this wasn't an actual issue in my tests, was just trying various things out whilst reading the spec. I don't personally have an issue if NavigateEvent is not user constructable.

Metadata

Metadata

Assignees

No one assigned

    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