Commit Graph

6628 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
37bded3522
Event: Increase robustness of an inner native event in leverageNative
In Firefox, alert displayed just before blurring an element dispatches
the native blur event twice which tripped the jQuery logic if a jQuery blur
handler was not attached before the trigger call.

This was because the `leverageNative` logic part for triggering first checked if
setup was done before (which, for example, is done if a jQuery handler was
registered before for this element+event pair) and - if it was not - added
a dummy handler that just returned `true`. The `leverageNative` logic made that
`true` then saved into private data, replacing the previous `saved` array. Since
`true` passed the truthy check, the second native inner handler treated `true`
as an array, crashing on the `slice` call.

The same issue could happen if a handler returning `true` is attached before
triggering. A bare `length` check would not be enough as the user handler may
return an array-like as well. To remove this potential data shape clash, capture
the inner result in an object with a `value` property instead of saving it
directly.

Since it's impossible to call `alert()` in unit tests, simulate the issue by
replacing the `addEventListener` method on a test button with a version that
calls attached blur handlers twice.

Fixes gh-5459
Closes gh-5466
Ref gh-5236

(cherry picked from commit 527fb3dcf0)
2024-05-20 18:05:38 +02:00
Timmy Willison
18adf66b44
Tests: include github ref in concurrency group
- fixes cancelled workflows when multiple PRs are merged
  in quick succession to both the main and 3.x-stable branches

Close gh-5482
2024-04-25 13:08:13 -04:00
Michał Gołębiowski-Owczarek
5d83fadb6b
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

(cherry picked from commit 399a78ee9f)
2024-04-25 00:25:27 +02:00
Michał Gołębiowski-Owczarek
5d5872bd58
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

(cherry picked from commit 7cdd837423)
2024-04-25 00:24:08 +02:00
dependabot[bot]
834b5bc6bb
Build: Bump actions/cache & actions/checkout
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](ab5e6d0c87...0c45773b62)

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

2. 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](b4ffde65f4...9bb56186c3)

---
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>

(partially cherry picked from commit df1df9503a)
2024-04-02 23:39:23 +02:00
Timmy Willison
cc44f76834
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-5465
2024-04-01 12:34:13 -04:00
Timmy Willison
feb75d3072
Tests: improve diffing for values of different types
Close gh-5455

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2024-03-27 12:18:37 -04:00
dependabot[bot]
953ff7172c
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](13aacd865c...ab5e6d0c87)

---
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

(cherry picked from commit 68f772e003)
2024-03-20 00:43:00 +01:00
Timmy Willison
36a43de3b7
Tests: show any and all actual/expected values
Close gh-5449
2024-03-15 17:44:21 -04:00
Timmy Willison
8350e5c63f
Tests: add diffing to test reporter
Close gh-5446
2024-03-14 14:28:38 -04:00
Timmy Willison
f8be4a52c0
Tests: add actual and expected messages to test reporter
Close gh-5444
2024-03-14 09:05:57 -04:00
Timmy Willison
d926cca9c6 Tests: fix worker restarts for failed browser acknowledgements
Close gh-5441
2024-03-11 13:36:09 -04:00
Timmy Willison
b56c6a415e Build: make compare size cache readable for manual edits
Ref gh-5441
2024-03-11 13:36:09 -04:00
Timmy Willison
fa3f5603d8 Build: fix size comparison for slim files when the branch is dirty
Ref gh-5441
2024-03-11 13:36:09 -04:00
Timmy Willison
79a19b412c Build: migrate more uses of fs.promises; use node: protocol
Ref gh-5441
2024-03-11 13:36:09 -04:00
Timmy Willison
2d8208e007
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-5439
2024-03-11 10:45:17 -04:00
Timmy Willison
11f0e6335e Tests: fix cleanup in cases where server doesn't stop 2024-03-09 10:36:33 -05:00
Timmy Willison
79329f5015 Build: drop support for Node 10
Close gh-5437
2024-03-09 10:36:33 -05:00
Timmy Willison
2ab173df6a
Build: add GitHub Actions workflow to update Filestash
Close gh-5435
2024-03-08 15:13:31 -05:00
Timmy Willison
003c958263
Tests: fix flakey message logs; ignore delete worker failures
Close gh-5431
2024-03-05 15:50:37 -05:00
Timmy Willison
ef434cd8d3
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**
- 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
- Browser workers are reused when running isolated modules in the same browser
- 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. Supports latest and latest-\d+ in place of browser version.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.

**Selenium**
- 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-5427
2024-03-05 13:53:39 -05:00
dependabot[bot]
633f688df7
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](704facf57e...13aacd865c)

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

Closes gh-5402

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

(cherry picked from commit bf11739f6c)
2024-02-11 01:48:39 +01:00
Michał Gołębiowski-Owczarek
164c314f88
Tests: Align middleware-mockerver.js with the main branch
Remove a redundant Express-targeted `resp.set` call from the `script` handler
in `middleware-mockserver.js` as was done on the `main` branch.

Closes gh-5413
Ref gh-5397
2024-02-09 18:22:07 +01:00
Timmy Willison
ba6ba5a4c1
Release: use buildDefaultFiles directly and pass version (#5409)
- 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
2024-02-06 10:16:05 -05:00
Timmy Willison
0360ec8e62
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-5405
2024-02-05 10:38:19 -05:00
Timmy Willison
0dd6490b79
Release: update build command in Release.generateArtifacts
Close gh-5400
2024-01-31 09:18:57 -05:00
Timmy Willison
23a3171dab
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-5396
2024-01-22 22:12:33 -05:00
Richard Gibson
ab0444dd64
Manipulation: Generalize a test to support IE
Ref gh-5378
Closes gh-5391

(cherry picked from commit 88690ebfc8)
2024-01-13 00:20:51 +01:00
dependabot[bot]
69c77cea07
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>
(cherry picked from commit 5613939470)
2024-01-12 01:13:27 +01:00
Richard Gibson
cbc15c9c31
Manipulation: Support $el.html(selfRemovingScript)
Don't try to remove a script element that has already removed itself.

Fixes gh-5377
Closes gh-5378

(cherry-picked from commit 937923d9ee)
2024-01-08 18:54:48 +01:00
Michał Gołębiowski-Owczarek
b922eed934
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](88522ab9f3...704facf57e)

---
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](f43a0e5ff2...b4ffde65f4)

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

3: 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](5e21ff4d9b...8f152de45c)

---
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-5356
Closes gh-5363

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 18:52:33 +01:00
Michał Gołębiowski-Owczarek
d354a45c3f
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

(cherry picked from commit 635cb152e7)
2023-11-13 18:23:03 +01:00
Michał Gołębiowski-Owczarek
b5b43adace
Tests: Workaround a tr width test issue in old iOS
Old iOS (<10) always rounds widths down, account for this in tests.

Closes gh-5361
Ref gh-5317
Ref gh-5359
2023-11-13 18:12:23 +01:00
Michał Gołębiowski-Owczarek
4e98980523
CSS: Fix reliableTrDimensions test for initially hidden iframes (3.x)
Also, account for the fact old Firefox (<61) has `null` computed style
for elements in such iframes.

Closes gh-5359
Ref gh-5317
Ref gh-5358
2023-11-07 00:35:56 +01:00
Stephen Sigwart
ac68b21fa0
CSS: Fix support test results for initially hidden iframes
If the iframe is not initially visible, the `scrollboxSize` support test is
failing. jQuery then cached this value and and applied the wrong result
undefinitely.

This breaks jQuery UI's Dialogs inside initially invisible iframes.

Closes gh-5317
Ref jquery/jquery-ui#2176
2023-11-02 10:48:08 +01:00
Michał Gołębiowski-Owczarek
e84886aa37
Build: Update ESLint-related packages, fix linting errors (3.x version)
The main change is the new rule in `eslint-config-jquery`:
`template-curly-spacing`.

Closes gh-5348
Ref jquery/eslint-config-jquery#21
Ref gh-5347
2023-11-02 00:48:05 +01:00
Michał Gołębiowski-Owczarek
cd27f30662
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

(cherry picked from commit 1ad66aeb6d)
2023-10-16 18:57:00 +02:00
Timmy Willison
ce52a5dbb0
Build: sort branches in compare_size; last run last
Close gh-5334
2023-09-21 17:47:18 -04:00
Timmy Willison
ec8802bafe
Build: migrate most grunt tasks off of grunt (3.x)
Close gh-5330

- 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 nodemon, which runs `npm run build:all` on `src` changes.

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
- run pretest script in jenkins

---------

Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
2023-09-20 18:18:42 -04:00
Michał Gołębiowski-Owczarek
6fe88690a3
Core: Simplify code post browser support reduction
Summary of the changes:
* 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

(cherry picked from commit 93ca49e6d1)
2023-09-20 00:59:32 +02:00
dependabot[bot]
a7cc3a0f04
Build: Bump actions/checkout & actions/setup-node
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](c85c95e3d7...f43a0e5ff2)

---
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](64ed1c7eab...5e21ff4d9b)

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

Closes gh-5311
Closes gh-5313

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

(cherry picked from commit 42e50f8c21)
2023-09-06 16:44:49 +02:00
Timmy Willison
0b38cbf2b9
Build: Updating the 3.x-stable version to 3.7.2-pre. 2023-08-28 09:39:27 -04:00
Timmy Willison
399b201bb3
Release: revert change that broke release
763ade6dda (diff-ba51b2c9ce2527b1f191cb2c210748a4f18cccc38893f7ffe1597fb1d23ce027L72)

The above change did not work because makeArchives was
not made to return a Promise
2023-08-28 09:31:17 -04:00
Timmy Willison
f85d521cde
Release: update authors 2023-08-28 09:16:52 -04:00
Michał Gołębiowski-Owczarek
763ade6dda
Build: Generate the slim build on grunt & run compare_size on it
Summary of the changes:
* expand `node_smoke_tests` to test the full & slim builds
* run `compare_size` on all built minified files; don't run it anymore on
  unminified files where they don't provide lots of value

The main goal of this change is to make it easier to compare sizes of both the
full & slim builds between the `3.x-stable` & `main` branches.

Closes gh-5291
Ref gh-5255

(partially cherry-picked from commit 8be4c0e4f8)
2023-07-10 20:45:30 +02:00
Michał Gołębiowski-Owczarek
a288838c6f
CSS: Make the reliableTrDimensions support test work with Bootstrap CSS (3.x version)
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-5279
Ref gh-5278
2023-07-10 18:26:45 +02:00
Michał Gołębiowski-Owczarek
87467a6f62
Selector: Only attach the unload handler in IE & Edge Legacy
Both IE & Edge Legacy need the workaround of calling `setDocument()` in an
`unload` handler to avoid "permission denied" errors. However, due to not being
possible to feature-detect this issue, the handler has been applied in all
browsers for windows different than the one in which jQuery was loaded.

jQuery 4.0, which drops Edge Legacy support, guards this workaround with
a `document.documentMode` check. This won't work in the 3.x line due to still
supporting Edge Legacy but we can check for
`document.documentElement.msMatchesSelector` instead as that API is
supported in IE 9+ and all Edge Legacy versions.

Fixes gh-5281
Closes gh-5282
Ref gh-4792
2023-07-10 18:25:56 +02:00
Michał Gołębiowski-Owczarek
3c18c1f33c
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

(cherry picked from commit 198b41c8c2)
2023-07-10 18:20:25 +02:00
Timmy Willison
72ae577c94
Build: switch preferred email for timmywil
Close gh-5289
2023-07-10 11:51:13 -04:00
dependabot[bot]
a370d7df42
Build: 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](8e5e7e5ab8...c85c95e3d7)

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

Closes gh-5283

(cherry picked from commit 4a13266efd)
2023-07-02 20:15:23 +02:00