Skip to content

events: static properties are configurable & writable #50417

@KhafraDev

Description

@KhafraDev

Version

v22

Platform

n/a

Subsystem

events

What steps will reproduce the bug?

Event.NONE = 'lol'
Event.CAPTURING_PHASE = 'lol'
Event.AT_TARGET = 'lol'
Event.BUBBLING_PHASE = 'lol'

Event.NONE // 'lol', should be 0
Event.CAPTURING_PHASE // 'lol', should be 1
Event.AT_TARGET // 'lol', should be 2
Event.BUBBLING_PHASE // 'lol', should be 3

How often does it reproduce? Is there a required condition?

n/a

What is the expected behavior? Why is that the expected behavior?

The idl definition for Event makes these properties constants. That means that they shouldn't be configurable or writable.

const props = ['NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE']

for (const prop of props) {
  const desc = Object.getOwnPropertyDescriptor(Event, prop)

  assert.strictEqual(desc.writable, false)
  assert.strictEqual(desc.configurable, false)
  assert.strictEqual(desc.enumerable, true)
}

What do you see instead?

shown above

Additional information

take a look at how it's being done for prototypical methods/properties, but do that for Event with the properties mentioned above.

ObjectDefineProperties(

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventtargetIssues and PRs related to the EventTarget implementation.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions