Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mgol opened this issue Oct 9, 2024 · 5 comments · Fixed by #559 · May be fixed by #573
Open

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

mgol opened this issue Oct 9, 2024 · 5 comments · Fixed by #559 · May be fixed by #573
Assignees
Milestone

Comments

@mgol
Copy link
Member

mgol commented Oct 9, 2024

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

@mgol mgol added this to the 3.6.0 milestone Oct 9, 2024
@mgol mgol self-assigned this Oct 9, 2024
@mgol mgol changed the title Warn about accessing props from Object.prototype in .data() Warn about accessing props from Object.prototype in .data()/jQuery.event.special Oct 9, 2024
@jquery jquery deleted a comment from E-pic-C Oct 14, 2024
@mgol
Copy link
Member Author

mgol commented Jan 14, 2025

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

@mgol
Copy link
Member Author

mgol commented Mar 17, 2025

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

@mgol mgol closed this as completed Mar 17, 2025
@mgol
Copy link
Member Author

mgol commented Mar 17, 2025

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

@mgol mgol reopened this Mar 17, 2025
mgol added a commit to mgol/jquery-migrate that referenced this issue Apr 8, 2025
Allow to use common `Object.prototype` properties on `jQuery.event.special` but
warn as well.

Fixes jquerygh-542
@mgol
Copy link
Member Author

mgol commented Apr 8, 2025

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.

mgol added a commit to mgol/jquery-migrate that referenced this issue Apr 14, 2025
Allow to use common `Object.prototype` properties on `jQuery.event.special` but
warn as well.

Fixes jquerygh-542
@mgol mgol linked a pull request Apr 14, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant