Skip to content

Warn about accessing props from Object.prototype in .data()/jQuery.event.special #542

Closed
@mgol

Description

@mgol

Since 4.0, .data() no longer inherits from Object.prototype; the same applies to the events object from the private data store.

We should not restore the old behavior as that will reintroduce potential collisions with Object.prototype. We should, though, warn if a key matching a key from Object.prototype is read.

Let's also handle jQuery.event.special which underwent the same changes.

Ref jquery/jquery#4603
Ref jquery/jquery#5235

Activity

added this to the 3.6.0 milestone on Oct 9, 2024
self-assigned this
on Oct 9, 2024
changed the title [-] Warn about accessing props from `Object.prototype` in `.data()`[/-] [+] Warn about accessing props from `Object.prototype` in `.data()`/`jQuery.event.special`[/+] on Oct 9, 2024
deleted a comment from E-pic-C on Oct 14, 2024
mgol

mgol commented on Jan 14, 2025

@mgol
MemberAuthor

For 3.6.0, this is handled in #559; for 4.0.0, in #561.

mgol

mgol commented on Mar 17, 2025

@mgol
MemberAuthor

The fix has landed in #559 for 3.x & #561 for 4.x, closing.

mgol

mgol commented on Mar 17, 2025

@mgol
MemberAuthor

Oh, actually, the jQuery.event.special part was not addressed yet, reopening.

reopened this on Mar 17, 2025
added a commit that references this issue on Apr 8, 2025
3fafc4f
mgol

mgol commented on Apr 8, 2025

@mgol
MemberAuthor

The 3.x PR for jQuery.event.special: #572.

The 4.0 PR will be created later when some dependends PRs land as described in #572.

The 4.0 PR for jQuery.event.special: #573.

12 remaining items

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Participants

    @mgol

    Issue actions

      Warn about accessing props from `Object.prototype` in `.data()`/`jQuery.event.special` · Issue #542 · jquery/jquery-migrate