Skip to content

Simulating with overrides throws for read-only properties #18

Description

@jimf

Howdy! I'm trying to simulate an ENTER keyup event using PhantomJS, but running into an exception:

simulateEvent.simulate(el, 'keyup', { keyCode: 13 })
// => TypeError: Attempting to change value of a readonly property.

The keyCode property is read-only (as per the spec), and when Object.defineProperty gets called with the specified override, the above exception is thrown.

I'd be happy to submit a PR, but I'm not quite sure if the fix is preferable here or here. It seems to me that we basically need to fall back to specifying all the overrides directly at construction time, but I'm not familiar enough with the event construction to know whether that belongs further up or further down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions