- Notifications
You must be signed in to change notification settings - Fork20.6k
Data:Event:Manipulation: Prevent collisions with Object.prototype properties#4603
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-19 bytes because of removals of fallbacks where they didn't seem needed IMO. I'd appreciate a review of those cases to be sure. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
70f64a0
to88ad53c
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
6e47006
to06eb190
CompareAdding "Needs review" back as a few things have changed since I reported the PR. It's now +0 bytes. |
…pertiesMake sure events & data keys matching Object.prototype properties work.A separate fix for such events on cloned elements was added as well.Fixesjquerygh-3256
06eb190
to5145f8e
CompareThe change injquerygh-4603 made the object returned by `elem.data()` a prototype-lessobject. That's a desired change to support keys colliding with Object.prototypeproperties but it's also a breaking change so it has to wait for jQuery 4.0.0.A 3.x-only test was added to avoid breaking it in the future on this branch.Fixesjquerygh-4665Refjquerygh-4603
The change ingh-4603 made the object returned by `elem.data()`a prototype-less object. That's a desired change to support keyscolliding with `Object.prototype` properties but it's also a breakingchange so it has to wait for jQuery 4.0.0.A 3.x-only test was added to avoid breaking it in the future on thisbranch.Fixesgh-4665Refgh-4603Closesgh-4666
This is a follow-up to similar changes to data & event storages fromjquerygh-4603.Refjquerygh-4603
Uh oh!
There was an error while loading.Please reload this page.
Summary
Make sure events & data keys matching Object.prototype properties work.
A separate fix for such events on cloned elements was added as well.
The commit also removes two unnecessary checks:
events
in private data in.trigger()
- only thehandle
key is needed.
events
private data to an empty object injQuery.event.dispatch
because that method is called from thehandle
function in element's private data and both
events
&handle
are set andremoved at the same time.
Fixesgh-3256
Checklist
.data()
returns an object with anull
prototype since4.0.0
api.jquery.com#1259)