Commit Graph

6645 Commits

Author SHA1 Message Date
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
Dimitri Papadopoulos Orfanos
4a29888c75
Docs: Fix typos found by codespell
Closes gh-5165

(cherry picked from commit 620870a1af)
2023-06-28 00:30:45 +02:00
Michał Gołębiowski-Owczarek
5aa7d93acf
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

(cherry picked from commit 62b9a25834)
2023-06-27 18:10:21 +02:00
Timmy Willison
141518e9c0
Docs: remove stale gitter badge from readme
Close gh-5274
2023-06-23 09:43:03 -04:00
Gabriela Gutierrez
0ea85dadaa
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/actions/checkout/releases/tag/v3.5.2
8e5e7e5ab8

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

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

Fixes gh-5266
Closes gh-5269

Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

(cherry picked from commit 784b9ba6e4)
2023-06-13 23:30:48 +02:00
Michał Gołębiowski-Owczarek
b84146ce17
Tests: Skip a new .text() test in IE 9
The test depends on `DOMParser`'s `parseFromString` called with `text/html`
which is not supported in IE 9.
2023-06-12 23:52:30 +02:00
Timo Tijhof
44c56f87a3
Core: Fix regression in jQuery.text() on HTMLDocument objects
Fixes gh-5264
Closes gh-5265
2023-06-12 23:12:15 +02:00
Michał Gołębiowski-Owczarek
13a870b60e
Selector: Re-expose jQuery.find.tokenize (3.x version)
`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.

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-5260
Ref gh-5263
Ref jquery/sizzle#242
Ref gh-5113
Ref gh-4395
Ref gh-4406
2023-06-12 22:58:58 +02:00
Michał Gołębiowski-Owczarek
992a66538b
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

(cherry picked from commit 988a56847d)
2023-05-31 18:57:29 +02:00
Michał Gołębiowski-Owczarek
7287894f1a
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

(cherry picked from commit fd6ffc5eb2)
2023-05-22 18:23:31 +02:00
Michał Gołębiowski-Owczarek
b473729d0e
Build: Test on Node.js 20, stop testing on Node.js 14 & 19
Closes gh-5250

(cherry picked from commit 6616acff0a)
2023-05-22 16:23:04 +02:00
Timmy Willison
64460dac2f
Build: Updating the 3.x-stable version to 3.7.1-pre. 2023-05-11 14:32:04 -04:00
Michał Gołębiowski-Owczarek
1a4d87afa0
Tests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (3.x version)
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-5226
2023-04-05 00:44:01 +02:00
Michał Gołębiowski-Owczarek
7bb48a0290
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

(cherry picked from commit bce13b72c1)
2023-04-04 16:03:06 +02:00
Michał Gołębiowski-Owczarek
9ab26aa508
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

(cherry picked from commit dfe212d5a1)
2023-04-03 18:21:30 +02:00
Michał Gołębiowski-Owczarek
14685b318a
Selector: Remove an obsolete comment
There was a comment claiming that there are two implementations
of `safeActiveElement`. However, the one in `event.js` got removed
in gh-5224, even before the comment was added.

This commit removes this obsolete comment.

Closes gh-5237
Ref gh-5224
2023-04-03 18:16:43 +02:00
Michał Gołębiowski-Owczarek
759232e5af
Tests: Fix tests added in gh-5233 2023-03-27 22:54:35 +02:00
Michał Gołębiowski-Owczarek
3eed28209e
CSS: Add missing jQuery.cssNumber entries
New entries cover `aspect-ratio`, `scale`, and a few others.

Also, remove quotes around `cssNumber` keys

A few properties have been taken from React:
afea1d0c53/packages/react-dom-bindings/src/shared/CSSProperty.js\#L8-L58

Fixes gh-5179
Closes gh-5233
2023-03-27 21:50:26 +02:00
Michał Gołębiowski-Owczarek
3936cf3ef3
Selector: Wrap activeElement access in try-catch
In IE 9 accessing `document.activeElement` may throw; see
https://bugs.jquery.com/ticket/13393. We've already guarded
against this in event code but not in selector.

Closes gh-5229
2023-03-27 21:48:38 +02:00
Michał Gołębiowski-Owczarek
754108fbbf
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

(cherry picked from commit 6ad3651dbf)
2023-03-27 21:47:24 +02:00
Michał Gołębiowski-Owczarek
59f7b55bf6
Event: Simulate focus/blur in IE via focusin/focusout (3.x version)
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).

To preserve relative `focusin`/`focus` & `focusout`/`blur` event order
guaranteed on the 3.x branch, attach a single handler for both events in IE.

A side effect of this is that to reduce size the `event/focusin` module
no longer exists and it's impossible to disable the `focusin` patch
in modern browsers via the jQuery custom build system.

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

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-03-27 21:24:42 +02:00
Michał Gołębiowski-Owczarek
4837a95b36
Tests: Add tests for arary data in ajax
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 didn't land on `3.x-stable`;
however... Surprisingly, we had no tests for array `data` values.
This change backports a few such missing tests added in gh-5203.

Ref gh-5197
Ref gh-5203
2023-03-21 00:36:51 +01:00
Michał Gołębiowski-Owczarek
212b6a4fce
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

(cherry picked from commit e77bd9d64f)
2023-03-20 17:14:15 +01:00
Michał Gołębiowski-Owczarek
98dd622a55
Tests: Skip jQuery.Deferred.exceptionHook tests in IE 9
The non-deprecated test was already skipped there, the deprecated
one is now skipped as well.

Ref gh-5212
2023-03-15 12:21:54 +01:00
Michał Gołębiowski-Owczarek
18139213ff
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

(cherry picked from commit cff2899885)
2023-03-15 11:45:26 +01:00
Michał Gołębiowski-Owczarek
cca7118658
Deferred: Rename getStackHook to getErrorHook (3.x version)
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 `3.7.0` version; PR gh-5211 implements
the `4.0.0` one.

Fixes gh-5201
Closes gh-5212
Ref gh-5211
2023-03-14 22:32:57 +01:00
Timmy Willison
3b7bf19998
Release: add support for md5 sums in windows
Close gh-5220
2023-03-09 20:19:28 +00:00
Michał Gołębiowski-Owczarek
63c3af481c
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-5207
Ref gh-5206
Ref gh-5098
Ref gh-5107
Ref w3c/csswg-drafts#7676
2023-02-14 11:42:29 +01:00
Michał Gołębiowski-Owczarek
ac1c59a354
Selector: Rename rcombinators to rleadingCombinator
Closes gh-5208
2023-02-13 18:35:02 +01:00
dependabot[bot]
582785e047
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>
(cherry picked from commit 7e7bd06207)
2023-02-06 16:43:26 +01:00
Michał Gołębiowski-Owczarek
732592c2a7
Tests: Fix selector tests in Chrome
For older Safari/iOS we needed to add the `safari` UA check as their reported
`WebKit` version was not new enough. However, that check should have also
excluded Chrome which was missed in the first iteration. This has been fixed.

Also, fix code formatting in `test/unit/css.js`.
2023-01-24 11:51:57 +01:00
Michał Gołębiowski-Owczarek
da7057e9b0
Build: Run GitHub Action browser tests on Playwright WebKit
So far, we've been running browser tests on GitHub Actions in Chrome
and Firefox. Regular Safari is not available in GitHub Actions but
Playwright WebKit comes close to a dev version of Safari.

With this change, our GitHub CI & local test runs will invoke tests on
all actively developed browser engines on all PRs.

Also, our GitHub Actions browser tests are now running on Node.js 18.

Detection of the Playwright WebKit browser in support unit tests is done
by checking if the `test_browser` query parameter is set to `"Playwright"`;
this is a `karma-webkit-launcher` feature. Detecting that browser via
user agent as we normally do is hard as the UA on Linux is very similar
to a real Safari one but it actually uses a newer version of the engine.

In addition, we now allow to pass custom browsers when one needs it;
e.g., to run the tests in all three engines on Linux/macOS, run:
```
grunt && BROWSERS=ChromeHeadless,FirefoxHeadless,WebkitHeadless grunt karma:main
```

Closes gh-5190

(cherry picked from commit b02a257f98)
2023-01-24 00:12:55 +01:00
Michał Gołębiowski-Owczarek
6b2abbdc46
Build: Migrate middleware-mockserver to modern JS
The `test/middleware-mockserver.js` file used to have the same ESLint
settings applied as other test files that are directly run in tested
browsers. Now it shares settings of other Node.js files.

The file is now also written using modern JS, leveraging ES2018.

Closes gh-5196

(cherry picked from commit ce90a48450)
2023-01-23 23:30:08 +01:00
Timmy Willison
e062f9cbc6
Docs: Remove stale badge from README
Close gh-5148

(cherry picked from commit bcd9c2bc3d)
2022-12-20 22:05:21 +01:00