Skip to content
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

Data: Patch camelCase behavior of $.fn.data, warn about Object.prototype #559

Draft
wants to merge 9 commits into
base: 3.x-stable
Choose a base branch
from

Conversation

mgol
Copy link
Member

@mgol mgol commented Jan 10, 2025

NOTE: Right now, this PR includes PR #554; only review the commit titled "Data: Patch camelCase behavior of $.fn.data, warn about Object.prototype". This PR should not be merged before #554; that's the only reason it's in a draft state.

Changes:

  1. Patch not only jQuery.data(), but also jQuery.fn.data().
  2. Patch jQuery.removeData() & jQuery.fn.removeData() to work in most cases
    when different keys with the same camelCase representation were passed to
    the data setter and later to removeData.
  3. Warn about using properties inherited from Object.prototype on data
    objects.

@mgol mgol added this to the 3.6.0 milestone Jan 10, 2025
@mgol mgol self-assigned this Jan 10, 2025
@mgol
Copy link
Member Author

mgol commented Jan 10, 2025

Tests are passing on all tested browsers, BTW: https://github.com/mgol/jquery-migrate/actions/runs/12713854358/job/35442704508

mgol added 7 commits January 14, 2025 12:30
This will save space and avoid potential divergence from Core.

To minimize risk, this only handles APIs still present in jQuery 4.x.
This fixes tests with 3.0/3.1 slim builds.
jQuery <3.2.0 doesn't include the deprecated module in the slim build so it
makes sense to test on one of these versions in slim mode even on PRs.
As of January 2025, iOS 10 is a tier 4 device on BrowserStack:
https://www.browserstack.com/device-tiers
That leads to devices with this iOS version often not being available and
failing our tests. Remove it from the test matrix. Also, add comments explaining
the status of tests on various iOS versions, including iOS 7 that we stopped
testing on a long time ago.

Ref jquery/jquery#5606
@mgol mgol force-pushed the 3.x-data branch 2 times, most recently from dac02fa to fdfb5a6 Compare January 14, 2025 11:50
mgol added 2 commits January 14, 2025 12:55
Changes:
1. Patch not only `jQuery.data()`, but also `jQuery.fn.data()`.
2. Patch `jQuery.removeData()` & `jQuery.fn.removeData()` to work in most cases
   when different keys with the same camelCase representation were passed to
   the data setter and later to `removeData`.
3. Warn about using properties inherited from `Object.prototype` on data
   objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant