]> source.dussan.org Git - jquery.git/log
jquery.git
6 months agoTests: Make the beforeunload event tests work regardless of extensions
Michał Gołębiowski-Owczarek [Wed, 24 Apr 2024 22:24:55 +0000 (00:24 +0200)]
Tests: Make the beforeunload event tests work regardless of extensions

Some browser extensions, like React DevTools, send messages to the content area.
Since our beforeunload event test listens for all messages, it used to catch
those as well, failing the test.

Add a `source` field to the payload JSON and check for it before treating the
message as coming from our own test to make sure the test passes even with such
browser extensions installed.

Closes gh-5478

6 months agoDocs: Update remaining HTTP URLs to HTTPS
Michał Gołębiowski-Owczarek [Wed, 24 Apr 2024 22:22:36 +0000 (00:22 +0200)]
Docs: Update remaining HTTP URLs to HTTPS

Update a few remaining HTTP URLs to HTTPS. The only ones left are XMLNS-like
URLs or ones to localhost - those need to stay as-is.

Closes gh-5479

7 months agoOffset: Increase search depth when finding the 'real' offset parent
Liam James [Fri, 19 Apr 2024 13:47:52 +0000 (23:47 +1000)]
Offset: Increase search depth when finding the 'real' offset parent

Changes:
* Increase search depth when finding for the real offset parent
* Ignore offset for statically positioned offset parent
* Add tests for the position of an element in a table

Closes gh-4861

7 months agoBuild: Bump actions/cache, actions/checkout & github/codeql-action
dependabot[bot] [Tue, 2 Apr 2024 21:35:25 +0000 (23:35 +0200)]
Build: Bump actions/cache, actions/checkout & github/codeql-action

1. Bump actions/cache from 4.0.1 to 4.0.2

Bumps [actions/cache](https://github.com/actions/cache) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/ab5e6d0c87105b4c9c2047343972218f562e4319...0c45773b623bea8c8e75f6c82b208c3cf94ea4f9)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

2. Bump github/codeql-action from 3.24.6 to 3.24.9

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.6 to 3.24.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/8a470fddafa5cbb6266ee11b37ef4d8aae19c571...1b1aada464948af03b950897e5eb522f92603cc2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Bump actions/checkout from 4.1.1 to 4.1.2

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/b4ffde65f46336ab88eb53be808477a3936bae11...9bb56186c3b09b4f86b1c65136769dd318469633)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Closes gh-5462

Signed-off-by: dependabot[bot] <support@github.com>
7 months agoTests: share queue/browser handling for all worker types
Timmy Willison [Mon, 1 Apr 2024 14:23:36 +0000 (10:23 -0400)]
Tests: share queue/browser handling for all worker types

- one queue to rule them all: browserstack, selenium, and jsdom
- retries and hard retries are now supported in selenium
- selenium tests now re-use browsers in the same way as browserstack

Close gh-5460

7 months agoBuild: Bump express from 4.18.3 to 4.19.2
dependabot[bot] [Fri, 29 Mar 2024 20:23:24 +0000 (21:23 +0100)]
Build: Bump express from 4.18.3 to 4.19.2

Bumps [express](https://github.com/expressjs/express) from 4.18.3 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.3...4.19.2)

Closes gh-5461

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7 months agoTests: improve diffing for values of different types
Timmy Willison [Wed, 27 Mar 2024 14:36:35 +0000 (10:36 -0400)]
Tests: improve diffing for values of different types

Close gh-5454

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
8 months agoAttributes: Make `.attr( name, false )` remove for all non-ARIA attrs
Michał Gołębiowski-Owczarek [Tue, 19 Mar 2024 23:46:30 +0000 (00:46 +0100)]
Attributes: Make `.attr( name, false )` remove for all non-ARIA attrs

The HTML spec defines boolean attributes:
https://html.spec.whatwg.org/#boolean-attributes
that often correlate with boolean properties. If the attribute is missing, it
correlates with the `false` property value, if it's present - the `true`
property value. The only valid values are an empty string or the attribute name.

jQuery tried to be helpful here and treated boolean attributes in a special way
in the `.attr()` API:
1. For the getter, as long as the attribute was present, it was returning the
   attribute name lowercased, ignoring the value.
2. For the setter, it was removing the attribute when `false` was passed;
   otherwise, it was ignoring the passed value and set the attribute -
   interestingly, in jQuery `>=3` not lowercased anymore.

The problem is the spec occasionally converts boolean attributes into ones with
additional attribute values with special behavior - one such example is the new
`"until-found"` value for the `hidden` attribute. Our setter normalization
means passing those values is impossible with jQuery. Also, new boolean
attributes are introduced occasionally and jQuery cannot easily add them to the
list without incurring breaking changes.

This patch removes any special handling of boolean attributes - the getter
returns the value as-is and the setter sets the provided value.

To provide better backwards compatibility with the very frequent `false` value
provided to remove the attribute, this patch makes `false` trigger attribute
removal for ALL non-ARIA attributes. ARIA attributes are exempt from the rule
since many of them recognize `"false"` as a valid value with semantics different
than the attribute missing. To remove an ARIA attribute, use `.removeAttr()` or
pass `null` as the value to `.attr()` which doesn't have this exception.

Fixes gh-5388
Closes gh-5452

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
8 months agoTests: show any and all actual/expected values
Timmy Willison [Fri, 15 Mar 2024 21:44:05 +0000 (17:44 -0400)]
Tests: show any and all actual/expected values

Close gh-5448

8 months agoTests: add diffing to test reporter
Timmy Willison [Thu, 14 Mar 2024 18:28:20 +0000 (14:28 -0400)]
Tests: add diffing to test reporter

Close gh-5445

8 months agoTests: add actual and expected messages to test reporter
Timmy Willison [Thu, 14 Mar 2024 13:05:42 +0000 (09:05 -0400)]
Tests: add actual and expected messages to test reporter

Close gh-5443

8 months agoCore: Fix the exports setup to make bundlers work with ESM & CommonJS
Michał Gołębiowski-Owczarek [Mon, 11 Mar 2024 23:39:34 +0000 (00:39 +0100)]
Core: Fix the exports setup to make bundlers work with ESM & CommonJS

We cannot pass a single file via the `module` condition as then
`require( "jquery" )` will not return jQuery but instead the module object
with `default`, `$` & `jQuery` as keys. Instead:

1. For Node.js, detected via the `node` condition:
    1. Expose a regular CommonJS version to `require`
    2. Expose a tiny wrapper over CommonJS to `import`
2. For bundlers, detected via the `module` condition:
    1. Expose a regular ESM version to `import`
    2. Expose a tiny wrapper over ESM to `require`
3. If neither Node.js nor bundlers are detected (no `node` or `module`
   conditions`):
    1. Expose a regular CommonJS version to `require`
    2. Expose a regular ESM version to `import`

The reasons for such definitions are as follows:
1. In Node.js, one can synchronously import from a CommonJS file inside of
   an ESM one but not vice-versa. To use an ESM file in a CommonJS one,
   a dynamic import is required and that forces asynchronicity.
2. In some bundlers CommonJS is not necessarily enabled - e.g. in Rollup without
   the CommonJS plugin. Therefore, the ESM version needs to be pure ESM.
   However, bundlers allow synchronously calling `require` on an ESM file. This
   is possible since bundlers merge the files before they are passed to
   the browser to execute and the final bundles no longer contain async import
   code.
3. Bare ESM & CommonJS versions are provided to non-Node non-bundler
   environments where we cannot assume interoperability between ESM & CommonJS
   is supported.
4. Bare versions cannot be supplied to Node or bundlers as projects using both
   ESM & CommonJS to fetch jQuery would result in duplicate jQuery instances,
   leading to increased JS size and disjoint data storage.

In addition to the above changes, the `script` condition has been dropped. Only
Webpack documents this condition and it's not clear when exactly it's triggered.
Adding support for a new condition can be added later without a breaking change;
removing is not so easy.

The `production` & `development` conditions have been removed as well. They were
not really applied correctly; we'd need to provide both of them to each current
leaf which would double the size of the definition for the `.` & `./slim` entry
points. In jQuery, the only difference between development & production builds
is minification; there are no logic changes so we can pass unminified versions
to all the tooling, expecting minification down the line.

As for the factory entry points:
1. Node.js always gets the CommonJS version
2. Bundlers always get the ESM version
3. Other tools take the ESM version when using `import` and the CommonJS when
   using `require`.

The complexity is lower than for the `.` & `./slim` entry points because there's
no default export to handle so Node/bundler wrapper files are not necessary.

Other changes:
* Tests: Change "node:assert" to "node:assert/strict"; the former is deprecated
* Docs: Mention that the CommonJS module doesn't expose named exports
* Tests: Run Node & bundler tests for all the above cases

Fixes gh-5416
Closes gh-5429

8 months agoTests: fix worker restarts for failed browser acknowledgements
Timmy Willison [Mon, 11 Mar 2024 14:51:06 +0000 (10:51 -0400)]
Tests: fix worker restarts for failed browser acknowledgements

Close gh-5440

8 months agoBuild: make compare size cache readable for manual edits
Timmy Willison [Sun, 10 Mar 2024 16:27:22 +0000 (12:27 -0400)]
Build: make compare size cache readable for manual edits

Ref gh-5440

8 months agoBuild: fix size comparison for slim files when the branch is dirty
Timmy Willison [Sun, 10 Mar 2024 16:19:58 +0000 (12:19 -0400)]
Build: fix size comparison for slim files when the branch is dirty

Ref gh-5440

8 months agoBuild: migrate more uses of fs.promises; use node: protocol
Timmy Willison [Sun, 10 Mar 2024 16:19:15 +0000 (12:19 -0400)]
Build: migrate more uses of fs.promises; use node: protocol

Ref gh-5440

8 months agoTests: add --hard-retries option to test runner
Timmy Willison [Mon, 11 Mar 2024 14:39:38 +0000 (10:39 -0400)]
Tests: add --hard-retries option to test runner

- Add the ability to retry by restarting the worker and
  getting a different browser instance, after all
  normal retries have been exhausted. This can sometimes
  be successful when a refresh is not.

Close gh-5438

8 months agoBuild: Bump github/codeql-action from 3.24.0 to 3.24.6
dependabot[bot] [Sun, 10 Mar 2024 14:37:30 +0000 (10:37 -0400)]
Build: Bump github/codeql-action from 3.24.0 to 3.24.6

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.0 to 3.24.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e8893c57a1f3a2b659b6b55564fdfdbbd2982911...8a470fddafa5cbb6266ee11b37ef4d8aae19c571)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Close gh-5425

8 months agoBuild: Bump actions/cache from 4.0.0 to 4.0.1
dependabot[bot] [Sun, 10 Mar 2024 14:36:56 +0000 (10:36 -0400)]
Build: Bump actions/cache from 4.0.0 to 4.0.1

Bumps [actions/cache](https://github.com/actions/cache) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/13aacd865c20de90d75de3b17ebe84f7a17d57d2...ab5e6d0c87105b4c9c2047343972218f562e4319)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Close gh-5424

8 months agoTests: fix cleanup in cases where server doesn't stop
Timmy Willison [Fri, 8 Mar 2024 23:40:55 +0000 (18:40 -0500)]
Tests: fix cleanup in cases where server doesn't stop

8 months agoBuild: drop support for Node 10
Timmy Willison [Fri, 8 Mar 2024 23:18:24 +0000 (18:18 -0500)]
Build: drop support for Node 10

Close gh-5436

8 months agoBuild: add GitHub Actions workflow to update Filestash
Timmy Willison [Fri, 8 Mar 2024 20:07:52 +0000 (15:07 -0500)]
Build: add GitHub Actions workflow to update Filestash

Close gh-5434

8 months agoTests: fix flakey message logs; ignore delete worker failures
Timmy Willison [Tue, 5 Mar 2024 20:50:51 +0000 (15:50 -0500)]
Tests: fix flakey message logs; ignore delete worker failures

Close gh-5432

8 months agoTests: reuse browser workers in BrowserStack tests (#5428)
Timmy Willison [Tue, 5 Mar 2024 19:44:01 +0000 (14:44 -0500)]
Tests: reuse browser workers in BrowserStack tests (#5428)

- reuse BrowserStack workers.
- add support for "latest" and "latest-1" in browser version filters
- add support for specifying non-final browser versions, such as beta versions
- more accurate eslint for files in test/runner
- switched `--no-isolate` command flag to `--isolate`. Now that browser instances are shared, it made more sense to me to default to no isolation unless specified. This turned out to be cleaner because the only place we isolate is in browserstack.yml.
- fixed an issue with retries where it wasn't always waiting for the retried test run
- enable strict mode in test yargs command

8 months agoTests: Use allowlist instead of whitelist
J.Son [Thu, 29 Feb 2024 23:40:41 +0000 (07:40 +0800)]
Tests: Use allowlist instead of whitelist

Closes gh-5420

8 months agoBuild: update jenkins script to only build
Timmy Willison [Mon, 26 Feb 2024 18:46:43 +0000 (13:46 -0500)]
Build: update jenkins script to only build

- this will soon be replaced by a new GH actions workflow

Close gh-5422

8 months agoTests: migrate testing infrastructure to minimal dependencies
Timmy Willison [Mon, 26 Feb 2024 14:42:10 +0000 (09:42 -0500)]
Tests: migrate testing infrastructure to minimal dependencies

This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes:

- `qunit` (our trusty unit testing library)
- `selenium-webdriver` (for spinning up local browsers)
- `express` (for starting a test server and adding middleware)
  - express middleware includes uses of `body-parser` and `raw-body`
- `yargs` (for constructing a CLI with pretty help text)
- BrowserStack (for running each of our QUnit modules separately in all of our supported browsers)
  - `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK)
  - We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly.

## BrowserStack Runner
- automatically retries individual modules in case of test failure(s)
- automatically attempts to re-establish broken tunnels
- automatically refreshes the page in case a test run has stalled
- runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none.
- supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.

## Selenium Runner
- supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge
- supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`)
- Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit.
- can run multiple browsers and multiple modules concurrently

Other notes:
- Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions:
  - `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x.
  - `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions.
  - `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions.
- BrowserStack tests are set to run on each `main` branch commit
- `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions.
- This PR includes a workflow to dispatch BrowserStack runs on-demand
- The Node version used for most workflow tests has been upgraded to 20.x
- updated supportjQuery to 3.7.1

Run `npm run test:unit -- --help` for CLI documentation

Close gh-5418

9 months agoBuild: Bump actions/cache & github/codeql-action (#5402)
dependabot[bot] [Sun, 11 Feb 2024 00:45:15 +0000 (01:45 +0100)]
Build: Bump actions/cache & github/codeql-action (#5402)

* Build: Bump actions/cache from 3.3.2 to 4.0.0

Bumps [actions/cache](https://github.com/actions/cache) from 3.3.2 to 4.0.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/704facf57e6136b1bc63b828d79edcd491f0ee84...13aacd865c20de90d75de3b17ebe84f7a17d57d2)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

* Build: Bump github/codeql-action from 3.22.12 to 3.24.0

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.22.12 to 3.24.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/012739e5082ff0c22ca6d6ab32e07c36df03c4a4...e8893c57a1f3a2b659b6b55564fdfdbbd2982911)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---------

Closes gh-5402
Closes gh-5415

Signed-off-by: dependabot[bot] <support@github.com>
9 months agoRelease: add factory files to release distribution
Timmy Willison [Fri, 9 Feb 2024 00:42:51 +0000 (19:42 -0500)]
Release: add factory files to release distribution

Fixes gh-5411
Close gh-5412

9 months agoTests: Fix Karma tests on Node.js 20
Michał Gołębiowski-Owczarek [Thu, 8 Feb 2024 22:52:19 +0000 (23:52 +0100)]
Tests: Fix Karma tests on Node.js 20

Node.js 20 started throwing errors when `writeHead` is called twice on
a response. This might have already been invalid before but it wasn't throwing
on Node.js 18.

Compute the headers object and call `writeHead` once to avoid the issue.

Closes gh-5397

9 months agoRelease: use buildDefaultFiles directly and pass version
Timmy Willison [Tue, 6 Feb 2024 14:53:30 +0000 (09:53 -0500)]
Release: use buildDefaultFiles directly and pass version

- also add the ability to pass VERSION in env to test final builds
- adjust sha regex to account for lack of shas
- set the version on the dist package.json

Close gh-5408

9 months agoRelease: copy dist-module folder as well
Timmy Willison [Mon, 5 Feb 2024 17:56:33 +0000 (12:56 -0500)]
Release: copy dist-module folder as well

Close gh-5407

9 months agoRelease: only published versioned files to cdn
Timmy Willison [Mon, 5 Feb 2024 16:51:11 +0000 (11:51 -0500)]
Release: only published versioned files to cdn

Close gh-5406

9 months agoRelease: remove scripts and dev deps from dist package.json
Timmy Willison [Mon, 5 Feb 2024 15:36:47 +0000 (10:36 -0500)]
Release: remove scripts and dev deps from dist package.json

- this became necessary due to the addition of the prepare script
- scripts aren't needed and don't work in the dist repo

Close gh-5404

9 months agoRelease: update build command in Release.generateArtifacts
Timmy Willison [Wed, 31 Jan 2024 14:18:41 +0000 (09:18 -0500)]
Release: update build command in Release.generateArtifacts

Close gh-5399

9 months agoAttributes: Shave off a couple of bytes
Michał Gołębiowski-Owczarek [Wed, 31 Jan 2024 00:47:11 +0000 (01:47 +0100)]
Attributes: Shave off a couple of bytes

The `attrHooks` entries for boolean attributes are only defined for jQuery 4+;
jQuery 3.x used a separate mechanism - assigning them to
`jQuery.expr.attrHandle`. That object used to be maintained by Sizzle, since
jQuery 3.7.0 it's kept in the selector module. Because of that, the `isXMLDoc`
check used to be require in this hook.

Now that standard `attrHooks` are used, the `isXMLDoc` check already happens
inside of `jQuery.attr` and there's no need to repeat it in the test. Note that
this repetition is even incorrect - while Sizzle's `jQuery.find.attr` used to
treat an `undefined` output of the hooks from `jQuery.expr.attrHandle` as a way
to opt out of the hook, jQuery's `attrHooks` use `null` to opt out of a getter
hook.

Apart from the size, this patch also avoids unnecessary extra checks.

Closes gh-5398

9 months agoData: Refactor to reduce size
Richard Gibson [Tue, 23 Jan 2024 03:13:23 +0000 (22:13 -0500)]
Data: Refactor to reduce size

* Return the new value from `set(owner, key, value)`.
* Use `set(owner, key, value)` rather than `access(owner, key, value)`.

Close gh-5392

9 months agoBuild: migrate grunt authors to a custom script
Timmy Willison [Tue, 23 Jan 2024 02:08:16 +0000 (21:08 -0500)]
Build: migrate grunt authors to a custom script

- the new script pulls all authors from the Sizzle repo
- added temporary grunt task for releases

Close gh-5395

10 months agoManipulation: Generalize a test to support IE
Richard Gibson [Fri, 12 Jan 2024 23:19:33 +0000 (18:19 -0500)]
Manipulation: Generalize a test to support IE

Ref gh-5378
Closes gh-5391

10 months agoSelector: Make `selector.js` module depend on `attributes/attr.js`
Michał Gołębiowski-Owczarek [Fri, 12 Jan 2024 00:18:03 +0000 (01:18 +0100)]
Selector: Make `selector.js` module depend on `attributes/attr.js`

This fixes custom builds using the `--include` switch that don't include
the `attributes` module.

Fixes gh-5379
Closes gh-5384

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
10 months agoBuild: Bump follow-redirects from 1.15.1 to 1.15.4
dependabot[bot] [Fri, 12 Jan 2024 00:12:52 +0000 (01:12 +0100)]
Build: Bump follow-redirects from 1.15.1 to 1.15.4

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.1 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.1...v1.15.4)

Closes gh-5389

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
10 months agoManipulation: Support $el.html(selfRemovingScript) (#5378)
Richard Gibson [Mon, 8 Jan 2024 17:30:39 +0000 (12:30 -0500)]
Manipulation: Support $el.html(selfRemovingScript) (#5378)

Don't try to remove a script element that has already removed itself.

Also, compress `DOMEval.js`.

Fixes gh-5377
Closes gh-5378

10 months agoSelector: Eliminate `selector.js` depenencies from various modules
Michał Gołębiowski-Owczarek [Thu, 4 Jan 2024 00:06:40 +0000 (01:06 +0100)]
Selector: Eliminate `selector.js` depenencies from various modules

There are two main reasons for why some of those dependencies are no longer
needed:
1. `jQuery.contains` which is now a part of `core`.
2. `jQuery.find.attr` no longer exists, native `getAttribute` is used instead.

Closes gh-5383
Ref gh-5379

10 months agoBuild: Bump actions/setup-node and github/codeql-action
dependabot[bot] [Mon, 1 Jan 2024 00:53:22 +0000 (00:53 +0000)]
Build: Bump actions/setup-node and github/codeql-action

1: Bump actions/setup-node from 4.0.0 to 4.0.1

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/8f152de45cc393bb48ce5d89d36b731f54556e65...b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

2: Bump github/codeql-action from 2.22.5 to 3.22.12

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.22.5 to 3.22.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/74483a38d39275f33fcff5f35b679b5ca4a26a99...012739e5082ff0c22ca6d6ab32e07c36df03c4a4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Closes gh-5381
Closes gh-5382

Signed-off-by: dependabot[bot] <support@github.com>
12 months agoBuild: Reformat GitHub workflow Yaml files
Michał Gołębiowski-Owczarek [Mon, 20 Nov 2023 17:20:16 +0000 (18:20 +0100)]
Build: Reformat GitHub workflow Yaml files

Use Prettier 3.1.0 to reformat the Yaml files. This makes their format identical
to the one used on `3.x-stable`, making for much easier cherry-picks.

The main difference is the list under `steps:` was not indented while all other
lists were.

Closes gh-5364

12 months agoBuild: Bump @babel/traverse & multiple actions
Michał Gołębiowski-Owczarek [Mon, 13 Nov 2023 17:44:30 +0000 (18:44 +0100)]
Build: Bump @babel/traverse & multiple actions

1: Bump actions/cache from 3.3.1 to 3.3.2

Bumps [actions/cache](https://github.com/actions/cache) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8...704facf57e6136b1bc63b828d79edcd491f0ee84)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

2: Bump actions/checkout from 3.6.0 to 4.1.1

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/f43a0e5ff2bd294095638e18286ca9a3d1956744...b4ffde65f46336ab88eb53be808477a3936bae11)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

3: Bump github/codeql-action from 2.21.5 to 2.22.5

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.21.5 to 2.22.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/00e563ead9f72a8461b24876bee2d0c2e8bd2ee8...74483a38d39275f33fcff5f35b679b5ca4a26a99)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

4: Bump actions/setup-node from 3.8.1 to 4.0.0

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.8.1 to 4.0.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d...8f152de45cc393bb48ce5d89d36b731f54556e65)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

5: Bump @babel/traverse from 7.22.5 to 7.23.2

Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Closes gh-5341
Closes gh-5349
Closes gh-5354
Closes gh-5355
Closes gh-5356
Closes gh-5363

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
12 months agoBuild: Don't run CI push workflows for dependabot branches
Michał Gołębiowski-Owczarek [Mon, 13 Nov 2023 17:18:20 +0000 (18:18 +0100)]
Build: Don't run CI push workflows for dependabot branches

Without this change, dependabot PRs run double checks - one set for the `push`
part and one for the `pull_request` part.

Closes gh-5353

12 months agoCSS: Fix reliableTrDimensions support test for initially hidden iframes
Michał Gołębiowski-Owczarek [Mon, 6 Nov 2023 23:35:52 +0000 (00:35 +0100)]
CSS: Fix reliableTrDimensions support test for initially hidden iframes

Closes gh-5358
Ref gh-5317
Ref gh-5359

12 months agoBuild: Update ESLint-related packages, fix linting errors
Michał Gołębiowski-Owczarek [Wed, 1 Nov 2023 23:48:50 +0000 (00:48 +0100)]
Build: Update ESLint-related packages, fix linting errors

The main change is the new rule in `eslint-config-jquery`:
`template-curly-spacing`.

Closes gh-5347
Ref jquery/eslint-config-jquery#21
Ref gh-5348

13 months agoBuild: Run pretest before test:* npm scripts
Michał Gołębiowski-Owczarek [Mon, 16 Oct 2023 16:54:54 +0000 (18:54 +0200)]
Build: Run pretest before test:* npm scripts

Build was already happening in scripts like `test:browser` but those scripts
were missing `pretest`, meaning that running `npm install && npm test:browser`
may have failed if `pretest` wasn't run before or if its results were out of
date.

Even worse, with such stale data some tests may erroneously succeed.

This also removes a separate `pretest` step from GitHub Actions as it's no
longer needed.

Closes gh-5338

14 months agoDocs: Fix module links in the package README
Michał Gołębiowski-Owczarek [Thu, 21 Sep 2023 23:39:05 +0000 (01:39 +0200)]
Docs: Fix module links in the package README

The package README used to show examples importing from a regular jQuery file;
this won't work natively. Instead, use module versions of jQuery in these
examples.

Closes gh-5336

14 months agoBuild: sort branches in compare_size; last run last
Timmy Willison [Thu, 21 Sep 2023 21:45:33 +0000 (17:45 -0400)]
Build: sort branches in compare_size; last run last

Close gh-5333

14 months agoBuild: run pretest in jenkins script
Timmy Willison [Wed, 20 Sep 2023 22:07:35 +0000 (18:07 -0400)]
Build: run pretest in jenkins script

14 months agoBuild: fix inconsistent builds in Node 20
Timmy Willison [Wed, 20 Sep 2023 21:19:21 +0000 (17:19 -0400)]
Build: fix inconsistent builds in Node 20

- one fileOverrides per build
- only run the lint build when running lint

Close gh-5332

14 months agoDocs: update watch task in CONTRIBUTING.md
Timmy Willison [Wed, 20 Sep 2023 22:10:57 +0000 (18:10 -0400)]
Docs: update watch task in CONTRIBUTING.md

Close gh-5331

14 months agoBuild: add commit SHAs and last runs to comparisons
Timmy Willison [Wed, 20 Sep 2023 01:15:45 +0000 (21:15 -0400)]
Build: add commit SHAs and last runs to comparisons

- only remove the short SHA and .dirty from version strings
- automatically reset the cache on version mismatch

Close gh-5329

14 months agoBuild: add new factory files to dist eslint
Timmy Willison [Wed, 20 Sep 2023 02:20:10 +0000 (22:20 -0400)]
Build: add new factory files to dist eslint

14 months agoCSS:Selector: Align with 3.x, remove the outer `selector.js` wrapper
Michał Gołębiowski-Owczarek [Wed, 20 Sep 2023 00:31:35 +0000 (02:31 +0200)]
CSS:Selector: Align with 3.x, remove the outer `selector.js` wrapper

Bring some changes from `3.x-stable`:
* rename `rtrim` to `rtrimCSS` to distinguish from the previous `rtrim`
  regex used for `jQuery.trim`
* backport one `id` selector test that avoids the selector engine path

Other changes:
* remove the inner function wrapper from `selector.js` by renaming
  the imported `document.js` value
* use `jQuery.error` in `selectorError`
* make Selector tests pass in all-modules runs by fixing a sinon mistake
  in Core tests - Core tests had a spy set up for `jQuery.error` that wasn't
  cleaned up, influencing Selector tests when all were run together

Closes gh-5295

14 months agoCore: Add more info about named exports
Michał Gołębiowski-Owczarek [Tue, 19 Sep 2023 23:29:05 +0000 (01:29 +0200)]
Core: Add more info about named exports

Also, fix an example importing from `jquery/src/css.js` as that is supposed
to use named exports now.

Closes gh-5328

14 months agoCore: Simplify code post browser support reduction
Michał Gołębiowski-Owczarek [Tue, 19 Sep 2023 22:54:40 +0000 (00:54 +0200)]
Core: Simplify code post browser support reduction

Summary of the changes:
* Core: Simplify code post browser support reduction
* Tests: Remove legacy jQuery.cache & oldIE leftovers
* Tests: Reformat JavaScript in delegatetest.html
* Docs: "jQuery Foundation Projects" -> "jQuery Projects"
* Tests: Drop an unused localfile.html file (modern browsers don't support
  the `file:` protocol this way, there's no point in keeping the file around)
* Effects: Remove a redundant `!fn` check (`fn || !fn && easing` is equivalent
  to `fn || easing`; simplify the code)
* CSS: Explain the fallback to direct object access in curCSS better
* Tests: Deduplicate `jQuery.parseHTML` test titles
* Dimensions: Add a test for fractional values
* Tests: Fix a buggy WebKit regex

Closes gh-5296

14 months agoCore: Move the factory to separate exports
Michał Gołębiowski-Owczarek [Tue, 19 Sep 2023 16:58:24 +0000 (18:58 +0200)]
Core: Move the factory to separate exports

Since versions 1.11.0/2.1.0, jQuery has used a module wrapper with one strange
addition - in CommonJS environments, if a global `window` with a `document` was
not present, jQuery exported a factory accepting a `window` implementation and
returning jQuery.

This approach created a number of problems:
1. Properly typing jQuery would be a nightmare as the exported value depends on
   the environment. In practice, typing definitions ignored the factory case.
2. Since we now use named exports for the jQuery module version, it felt weird
   to have `jQuery` and `$` pointing to the factory instead of real jQuery.

Instead, for jQuery 4.0 we leverage the just added `exports` field in
`package.json` to expose completely separate factory entry points: one for the
full build, one for the slim one.

Exports definitions for `./factory` & `./factory-slim` are simpler than for `.`
and `./slim` - this is because it's a new entry point, we only expose a named
export and so there's no issue with just pointing Node.js to the CommonJS
version (we cannot use the module version for `import` from Node.js to avoid
double package hazard). The factory entry points are also not meant for the Web
browser which always has a proper `window` - and they'd be unfit for an
inclusion in a regular script tag anyway. Because of that, we also don't
generate minified versions of these entry points.

The factory files are not pushed to the CDN since they are mostly aimed
at Node.js.

Closes gh-5293

14 months agoBuild: Bump qs, socket.io-parser, socket.io & json5
dependabot[bot] [Mon, 18 Sep 2023 16:39:28 +0000 (16:39 +0000)]
Build: Bump qs, socket.io-parser, socket.io & json5

1: Bump json5 from 2.2.0 to 2.2.3

Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.0...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

2: Bump socket.io-parser and socket.io

Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser)
and [socket.io](https://github.com/socketio/socket.io). These dependencies
needed to be updated together.

Updates `socket.io-parser` from 4.0.5 to 4.2.4
- [Release notes](https://github.com/socketio/socket.io-parser/releases)
- [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-parser/compare/4.0.5...4.2.4)

Updates `socket.io` from 4.5.1 to 4.7.2
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/4.5.1...4.7.2)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-type: indirect
- dependency-name: socket.io
  dependency-type: indirect
...

3: Bump qs from 6.5.2 to 6.5.3

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Closes gh-5324
Closes gh-5325
Closes gh-5326

Signed-off-by: dependabot[bot] <support@github.com>
14 months agoBuild: migrate most grunt tasks off of grunt
Timmy Willison [Mon, 18 Sep 2023 16:39:00 +0000 (12:39 -0400)]
Build: migrate most grunt tasks off of grunt

Updated tasks include:

- lint
- npmcopy
- build, minify, and process for distribution.
- new custom build command using yargs
- compare size of minified/gzip built files
- pretest scripts, including qunit-fixture, babel transpilation, and npmcopy
- node smoke tests
- promises aplus tests
- new watch task using `rollup.watch` directly

Also:

- upgraded husky and added the new lint command
- updated lint config to use new "flat" config format. See https://eslint.org/docs/latest/use/configure/configuration-files-new
- Temporarily disabled one lint rule until flat config is supported by eslint-plugin-import. See https://github.com/import-js/eslint-plugin-import/issues/2556
- committed package-lock.json
- updated all test scripts to use the new build
- added an express test server that uses middleware-mockserver (this can be used to run tests without karma)
- build-all-variants is now build:all

Close gh-5318

14 months agoCore: Use named exports in `src/`
Michał Gołębiowski-Owczarek [Tue, 12 Sep 2023 00:27:19 +0000 (02:27 +0200)]
Core: Use named exports in `src/`

The `default` export is treated differently across tooling when transpiled
to CommonJS - tools differ on whether `module.exports` represents the full
module object or just its default export. Switch `src/` modules to named
exports for tooling consistency.

Fixes gh-5262
Closes gh-5292

14 months agoBuild: Bump actions/checkout, actions/setup-node & github/codeql-action
dependabot[bot] [Fri, 1 Sep 2023 00:37:59 +0000 (00:37 +0000)]
Build: Bump actions/checkout, actions/setup-node & github/codeql-action

1: Bump actions/checkout from 3.5.3 to 3.6.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...f43a0e5ff2bd294095638e18286ca9a3d1956744)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

2: Bump actions/setup-node from 3.6.0 to 3.8.1

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.6.0 to 3.8.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c...5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

3: Bump github/codeql-action from 2.20.1 to 2.21.5

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.20.1 to 2.21.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f6e388ebf0efc915c6c5b165b019ee61a6746a38...00e563ead9f72a8461b24876bee2d0c2e8bd2ee8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Closes gh-5311
Closes gh-5312
Closes gh-5313

Signed-off-by: dependabot[bot] <support@github.com>
14 months agoBuild: Update mailmap entry for Krinkle
Timo Tijhof [Fri, 25 Aug 2023 14:19:15 +0000 (15:19 +0100)]
Build: Update mailmap entry for Krinkle

Close gh-5309

15 months agoBuild: replace CRLF with LF during minify
Timmy Willison [Fri, 11 Aug 2023 01:13:24 +0000 (21:13 -0400)]
Build: replace CRLF with LF during minify

- SWC is not respecting the git setting and does not have
  an option to force LF. This fixes the build on Windows.

Close gh-5305

16 months agoBuild: Add `exports` to package.json, export slim & esm builds
Michał Gołębiowski-Owczarek [Mon, 10 Jul 2023 17:14:08 +0000 (19:14 +0200)]
Build: Add `exports` to package.json, export slim & esm builds

Summary of the changes:
* define the `exports` field in `package.json`; `jQuery` & `$` are also
  exported as named exports in ESM builds now
* declare `"type": "module"` globally except for the `build` folder
* add the `--esm` option to `grunt custom`, generating jQuery as an ECMAScript
  module into the `dist-module` folder
* expand `node_smoke_tests` to test the slim & ESM builds and their various
  combinations; also, test both jQuery loaded via a path to the file as well
  as from module specifiers that should be parsed via the `exports` feature
* add details about ESM usage to the release package README
* run `compare_size` on all built minified files; don't run it anymore on
  unminified files where they don't provide lots of value
* remove the remove_map_comment task; SWC doesn't insert the
`//# sourceMappingURL=` pragma by default so there's nothing to strip

Fixes gh-4592
Closes gh-5255

16 months agoCSS: Make the reliableTrDimensions support test work with Bootstrap CSS
Michał Gołębiowski-Owczarek [Mon, 10 Jul 2023 16:33:05 +0000 (18:33 +0200)]
CSS: Make the reliableTrDimensions support test work with Bootstrap CSS

Bootstrap 5 includes the following CSS on the page:

```css
*,
*::before,
*::after {
  box-sizing: border-box;
}
```

That threw our `reliableTrDimensions` support test off. This change fixes the
support test and adds a unit test ensuring support test values on a page
including Bootstrap 5 CSS are the same as on a page without it.

Fixes gh-5270
Closes gh-5278
Ref gh-5279

16 months agoBuild: Switch form Terser to SWC for JS minification (#5286)
Michał Gołębiowski-Owczarek [Mon, 10 Jul 2023 16:23:07 +0000 (18:23 +0200)]
Build: Switch form Terser to SWC for JS minification (#5286)

Also, as part of this, fix the `file` & `sources` properties of the source map
file.

Fixes gh-5285
Closes gh-5286
Ref gh-5258

16 months agoBuild: Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well
Michał Gołębiowski-Owczarek [Mon, 10 Jul 2023 16:19:52 +0000 (18:19 +0200)]
Build: Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well

We've had this rule for `*.js` files so far but we now have two new JS
extensions.

Closes gh-5290

16 months agoBuild: switch preferred email for timmywil
Timmy Willison [Mon, 10 Jul 2023 14:59:12 +0000 (10:59 -0400)]
Build: switch preferred email for timmywil

Close gh-5288

16 months agoBuild: Bump github/codeql-action & actions/checkout
dependabot[bot] [Sat, 1 Jul 2023 00:28:46 +0000 (00:28 +0000)]
Build: Bump github/codeql-action & actions/checkout

1: Bump github/codeql-action from 2.3.6 to 2.20.1

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.6 to 2.20.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/83f0fe6c4988d98a455712a27f0255212bba9bd4...f6e388ebf0efc915c6c5b165b019ee61a6746a38)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

2: Build: Bump actions/checkout from 3.5.2 to 3.5.3

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8e5e7e5ab8b370d6c329ec480221332ada57f0ab...c85c95e3d7251135ab7dc9ce3241c5835cc595a9)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Closes gh-5283
Closes gh-5284

16 months agoDocs: Fix typos found by codespell
Dimitri Papadopoulos Orfanos [Tue, 27 Jun 2023 22:29:29 +0000 (00:29 +0200)]
Docs: Fix typos found by codespell

Closes gh-5165

16 months agoBuild: Drop individual AMD modules
Michał Gołębiowski-Owczarek [Tue, 27 Jun 2023 16:23:58 +0000 (18:23 +0200)]
Build: Drop individual AMD modules

With this change, jQuery build no longer generates the `amd` directory with
AMD modules transpiled from source `src` ECMAScript Modules. To use individual
jQuery modules from source, ESM is now required.

Note that this DOES NOT affect the main `"jquery"` AMD module defined by built
jQuery files; those remain supported.

Closes gh-5276

16 months agoTests: Disable the ":lang respects escaped backslashes" test
Michał Gołębiowski-Owczarek [Tue, 27 Jun 2023 16:05:46 +0000 (18:05 +0200)]
Tests: Disable the ":lang respects escaped backslashes" test

Firefox 114+ no longer match on backslashes in `:lang()`, even when escaped.
It is an intentional change as `:lang()` parameters are supposed to be valid
BCP 47 strings. Therefore, we won't attempt to patch it.
We'll keep this test here until other browsers match the behavior.

Fixes gh-5271
Closes gh-5277
Ref https://bugzilla.mozilla.org/show_bug.cgi?id=1839747#c1
Ref https://github.com/w3c/csswg-drafts/issues/8720#issuecomment-1509242961

16 months agoDocs: remove stale gitter badge from readme
Timmy Willison [Fri, 23 Jun 2023 13:43:26 +0000 (09:43 -0400)]
Docs: remove stale gitter badge from readme

Close gh-5273

17 months agoBuild: Reference GitHub Actions by commit SHAs
Gabriela Gutierrez [Tue, 13 Jun 2023 21:22:07 +0000 (21:22 +0000)]
Build: Reference GitHub Actions by commit SHAs

The SHAs are verified to come from the original repositories and not forks.

For reference:

https://github.com/github/codeql-action/releases/tag/v2.3.6
https://github.com/github/codeql-action/commit/83f0fe6c4988d98a455712a27f0255212bba9bd4

https://github.com/actions/checkout/releases/tag/v3.5.2
https://github.com/actions/checkout/commit/8e5e7e5ab8b370d6c329ec480221332ada57f0ab

https://github.com/actions/cache/releases/tag/v3.3.1
https://github.com/actions/cache/commit/88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8

https://github.com/actions/setup-node/releases/tag/v3.6.0
https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c

Fixes gh-5266
Closes gh-5269

Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>
17 months agoCore: Fix regression in jQuery.text() on HTMLDocument objects
Timo Tijhof [Mon, 12 Jun 2023 21:12:15 +0000 (22:12 +0100)]
Core: Fix regression in jQuery.text() on HTMLDocument objects

Fixes gh-5264
Closes gh-5265

(cherry picked from commit 44c56f87a31fbc1f43ac575cfd06a0df12073352)

17 months agoSelector: Re-expose jQuery.find.{tokenize,select,compile,setDocument}
Michał Gołębiowski-Owczarek [Mon, 12 Jun 2023 20:58:55 +0000 (22:58 +0200)]
Selector: Re-expose jQuery.find.{tokenize,select,compile,setDocument}

`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,
it has historically been available in jQuery via `jQuery.find.tokenize`.
That got dropped during Sizzle removal; this change restores the API.

Some other APIs so far only exposed on the `3.x` line are also added
back:
* `jQuery.find.select`
* `jQuery.find.compile`
* `jQuery.find.setDocument`

In addition to that, Sizzle tests have been backported for the following
APIs:
* `jQuery.find.matchesSelector`
* `jQuery.find.matches`
* `jQuery.find.compile`
* `jQuery.find.select`

A new test was also added for `jQuery.find.tokenize` - even Sizzle was
missing one.

Fixes gh-5259
Closes gh-5263
Ref gh-5260
Ref jquery/sizzle#242
Ref gh-5113
Ref gh-4395
Ref gh-4406

17 months agoBuild: Switch the minifier from UglifyJS to Terser
Michał Gołębiowski-Owczarek [Wed, 31 May 2023 16:59:35 +0000 (18:59 +0200)]
Build: Switch the minifier from UglifyJS to Terser

UglifyJS is ES5-only, while Terser supports newer ECMAScript versions. jQuery
is authored in ES5 but jQuery 4.x will also have an ESM build that cannot be
minified using UglifyJS directly.

We could strip the `export` statement, minify via UglifyJS and re-add one but
that increases complexity & may not fully play nice with source maps.

On the other hand, switching to Terser increases the minfied size by just 324
bytes and the minified gzipped one by just 70 bytes. Such differences largely
disappear among bigger size gains from the `3.x-stable` line - around 2.7 KB
minified gzipped as of now.

Closes gh-5258

17 months agoDocs: Remove the "Grunt build" section from the PR template
Michał Gołębiowski-Owczarek [Wed, 31 May 2023 16:57:13 +0000 (18:57 +0200)]
Docs: Remove the "Grunt build" section from the PR template

Now that unit tests are run on GitHub Actions in all three major
engines and for multiple custom jQuery builds, the request for PR
authors to run unit tests locally and confirm they pass is needless
overhead; let's drop the checkbox.

Closes gh-5261

17 months agoBuild: Make the `eslint:dev` task not lint the `dist/` folder
Michał Gołębiowski-Owczarek [Wed, 31 May 2023 16:55:29 +0000 (18:55 +0200)]
Build: Make the `eslint:dev` task not lint the `dist/` folder

There was a mistake in paths logic that made the `dist/` folder linted
even in the `eslint:dev` task which is run before the build. Fix that by
explicitly ignoring the `dist/` folder at the end of the file list.

Closes gh-5257

18 months agoDeprecated: Define `.hover()` using non-deprecated methods
Michał Gołębiowski-Owczarek [Mon, 22 May 2023 16:23:19 +0000 (18:23 +0200)]
Deprecated: Define `.hover()` using non-deprecated methods

Make the deprecated `.hover()` method not rely on other deprecated
methods: `.mouseenter()` & `.mouseleave()`. Use `.on()` instead.

Closes gh-5251

18 months agoBuild: Test on Node.js 20, stop testing on Node.js 14 & 19
Michał Gołębiowski-Owczarek [Mon, 22 May 2023 14:21:35 +0000 (16:21 +0200)]
Build: Test on Node.js 20, stop testing on Node.js 14 & 19

Closes gh-5250

19 months agoTests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test
Michał Gołębiowski-Owczarek [Tue, 4 Apr 2023 22:25:20 +0000 (00:25 +0200)]
Tests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test

Chrome 112 & Safari 16.4 introduce two changes:
* `:has()` is non-forgiving
* `CSS.supports( "selector(...)" )` parses everything in a non-forgiving way

We no longer care about the latter but the former means the `cssHas` support
test now passes.

Closes gh-5225

19 months agoCSS: Make `offsetHeight( true )`, etc. include negative margins
Michał Gołębiowski-Owczarek [Tue, 4 Apr 2023 14:00:55 +0000 (16:00 +0200)]
CSS: Make `offsetHeight( true )`, etc. include negative margins

This regressed in gh-3656 as the added logic to include scroll gutters
in `.innerWidth()` / `.innerHeight()` didn't take negative margins into
account. This broke handling of negative margins in
`.offsetHeight( true )` and `.offsetWidth( true )`. To fix it, calculate
margin delta separately and only add it after the scroll gutter
adjustment logic.

Fixes gh-3982
Closes gh-5234
Ref gh-3656

19 months agoEvent: Avoid collisions between jQuery.event.special & Object.prototype
Michał Gołębiowski-Owczarek [Mon, 3 Apr 2023 16:40:24 +0000 (18:40 +0200)]
Event: Avoid collisions between jQuery.event.special & Object.prototype

This is a follow-up to similar changes to data & event storages from
gh-4603.

Closes gh-5235
Ref gh-4603

19 months agoEvent: Simplify the check for saved data in leverageNative
Michał Gołębiowski-Owczarek [Mon, 3 Apr 2023 16:21:15 +0000 (18:21 +0200)]
Event: Simplify the check for saved data in leverageNative

Previously, when `leverageNative` handled async events, there was
a case where an empty placeholder object was set as a result.
Covering both such an object and `false` required a `length` check.
However, this is not necessary since gh-5223 and the check was
already simplified in other places; this one was missed.

Closes gh-5236
Ref gh-5223

19 months agoEvent: Make trigger(focus/blur/click) work with native handlers
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 19:47:01 +0000 (21:47 +0200)]
Event: Make trigger(focus/blur/click) work with native handlers

In `leverageNative`, instead of calling `event.stopImmediatePropagation()`
which would abort both native & jQuery handlers, set the wrapper's
`isImmediatePropagationStopped` property to a function returning `true`.
Since for each element + type pair jQuery attaches only one native handler,
there is also only one wrapper jQuery event so this achieves the goal:
on the target element jQuery handlers don't fire but native ones do.

Unfortunately, this workaround doesn't work for handlers on ancestors
- since the native event is re-wrapped by a jQuery one on each level of
the propagation, the only way to stop it for jQuery was to stop it for
everyone via native `stopPropagation()`. This is not a problem for
`focus`/`blur` which don't bubble, but it does also stop `click` on
checkboxes and radios. We accept this limitation.

Fixes gh-5015
Closes gh-5228

19 months agoEvent: Simulate focus/blur in IE via focusin/focusout
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 19:22:38 +0000 (21:22 +0200)]
Event: Simulate focus/blur in IE via focusin/focusout

In IE (all versions), `focus` & `blur` handlers are fired asynchronously
but `focusin` & `focusout` are run synchronously. In other browsers, all
those handlers are fired synchronously. Asynchronous behavior of these
handlers in IE caused issues for IE (gh-4856, gh-4859).

We now simulate `focus` via `focusin` & `blur` via `focusout` in IE to avoid
these issues. This also let us simplify some tests.

This commit also simplifies `leverageNative` - with IE now using `focusin`
to simulate `focus` and `focusout` to simulate `blur`, we don't have to deal
with async events in `leverageNative`. This also fixes broken `focus` triggers
after first triggering it on a hidden element - previously, `leverageNative`
assumed that the native `focus` handler not firing after calling the native
`focus` method meant it would be handled later, asynchronously, which
was not the case (gh-4950).

Fixes gh-4856
Fixes gh-4859
Fixes gh-4950
Closes gh-5223

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
20 months agoAjax: Don't treat array data as binary
Michał Gołębiowski-Owczarek [Mon, 20 Mar 2023 23:36:00 +0000 (00:36 +0100)]
Ajax: Don't treat array data as binary

PR gh-5197 started treating all non-string non-plain-object
`data` values as binary. However, `jQuery.ajax` also supports
arrays as values of `data`. This change makes regular arrays
no longer be considered binary data.

Surprisingly, we had no tests for array `data` values; otherwise,
we'd detect the issue earlier. This change also adds
a few such missing tests.

Closes gh-5203
Ref gh-5197

20 months agoBuild: Only install Playwright dependencies when needed
Michał Gołębiowski-Owczarek [Mon, 20 Mar 2023 16:13:31 +0000 (17:13 +0100)]
Build: Only install Playwright dependencies when needed

PR gh-5190 added support for running tests on Playwright WebKit
in CI. For efficiency reasons, Playwright dependencies are only
installed for the `test:browser` npm script. However, that same
script is also used for Firefox ESR testing.

This change makes Playwright dependencies installed only for cases
where `WebKitHeadless` exists on the list of tested browsers.

Closes gh-5204
Ref gh-5190

20 months agoAjax: Allow `processData: true` even for binary data
Michał Gołębiowski-Owczarek [Mon, 20 Mar 2023 16:08:51 +0000 (17:08 +0100)]
Ajax: Allow `processData: true` even for binary data

The way gh-5197 implemented binary data handling, `processData`
was being explicitly set to `false`. This is expected but it made
it impossible to override it to `true`. The new logic will only
set `processData` to `false` if it wasn't explicitly passed
in original options.

Closes gh-5205
Ref gh-5197

20 months agoTests: Test AJAX deprecated event aliases properly
Michał Gołębiowski-Owczarek [Wed, 15 Mar 2023 10:44:08 +0000 (11:44 +0100)]
Tests: Test AJAX deprecated event aliases properly

PR gh-5046 erroneously changed AJAX deprecated event alias
usage in deprecated tests to `.on()` calls. This change
reverses this mistake.

Closes gh-5195
Ref gh-5046

20 months agoDeferred: Rename `getStackHook` to `getErrorHook`
Michał Gołębiowski-Owczarek [Tue, 14 Mar 2023 21:32:45 +0000 (22:32 +0100)]
Deferred: Rename `getStackHook` to `getErrorHook`

Rename `jQuery.Deferred.getStackHook` to `jQuery.Deferred.getErrorHook`
to indicate passing an error instance is usually a better choice - it
works with source maps while a raw stack generally does not.

In jQuery `3.7.0`, we'll keep both names, marking the old one as
deprecated. In jQuery `4.0.0` we'll just keep the new one. This
change implements the `4.0.0` version; PR gh-5212 implements
the `3.7.0` one.

Fixes gh-5201
Closes gh-5211
Ref gh-5212

20 months agoRelease: add support for md5 sums in windows
Timmy Willison [Thu, 9 Mar 2023 20:19:07 +0000 (15:19 -0500)]
Release: add support for md5 sums in windows

Close gh-5219

21 months agoSelector: Stop relying on CSS.supports( "selector(...)" )
Michał Gołębiowski-Owczarek [Tue, 14 Feb 2023 09:11:40 +0000 (10:11 +0100)]
Selector: Stop relying on CSS.supports( "selector(...)" )

`CSS.supports( "selector(...)" )` has different semantics than selectors passed
to `querySelectorAll`. Apart from the fact that the former returns `false` for
unrecognized selectors and the latter throws, `qSA` is more forgiving and
accepts some invalid selectors, auto-correcting them where needed - for
example, mismatched brackers are auto-closed. This behavior difference is
breaking for many users.

To add to that, a recent CSSWG resolution made `:is()` & `:where()` the only
pseudos with forgiving parsing; browsers are in the process of making `:has()`
parsing unforgiving.

Taking all that into account, we go back to our previous try-catch approach
without relying on `CSS.supports( "selector(...)" )`. The only difference
is we detect forgiving parsing in `:has()` and mark the selector as buggy.

The PR also updates `playwright-webkit` so that we test against a version
of WebKit that already has non-forgiving `:has()`.

Fixes gh-5194
Closes gh-5206
Ref gh-5098
Ref gh-5107
Ref w3c/csswg-drafts#7676

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
21 months agoSelector: Backport jQuery selection context logic to selector-native
Michał Gołębiowski-Owczarek [Mon, 13 Feb 2023 17:34:41 +0000 (18:34 +0100)]
Selector: Backport jQuery selection context logic to selector-native

This makes:
```js
$div.find("div > *")
```
no longer matching children of `$div`.

Also, leading combinators now work, e.g.:
```js
$div.find( "> *" );
```
returns children of `$div`.

As a result of that, a number of tests are no longer skipped in the
`selector-native` mode.

Also, rename `rcombinators` to `rleadingCombinator`.

Fixes gh-5185
Closes gh-5186
Ref gh-5085

21 months agoBuild: Bump actions/setup-node from 3.5.1 to 3.6.0
dependabot[bot] [Thu, 2 Feb 2023 00:43:00 +0000 (01:43 +0100)]
Build: Bump actions/setup-node from 3.5.1 to 3.6.0

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.5.1 to 3.6.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3.5.1...v3.6.0)

Closes gh-5200

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>