]> source.dussan.org Git - jquery.git/log
jquery.git
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

(cherry picked from commit dfe212d5a1eed6b4a67d1cbd04ece09bbac33699)

19 months agoSelector: Remove an obsolete comment
Michał Gołębiowski-Owczarek [Mon, 3 Apr 2023 16:16:43 +0000 (18:16 +0200)]
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

19 months agoTests: Fix tests added in gh-5233
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 20:54:35 +0000 (22:54 +0200)]
Tests: Fix tests added in gh-5233

19 months agoCSS: Add missing jQuery.cssNumber entries
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 19:50:26 +0000 (21:50 +0200)]
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:
https://github.com/facebook/react/blob/afea1d0c536e0336735b0ea5c74f635527b65785/packages/react-dom-bindings/src/shared/CSSProperty.js\#L8-L58

Fixes gh-5179
Closes gh-5233

19 months agoSelector: Wrap activeElement access in try-catch
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 19:48:38 +0000 (21:48 +0200)]
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

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

(cherry picked from commit 6ad3651dbfea9e9bb56e608f72b4ef2f97bd4e70)

19 months agoEvent: Simulate focus/blur in IE via focusin/focusout (3.x version)
Michał Gołębiowski-Owczarek [Mon, 27 Mar 2023 19:24:42 +0000 (21:24 +0200)]
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>
20 months agoTests: Add tests for arary data in ajax
Michał Gołębiowski-Owczarek [Mon, 6 Feb 2023 17:52:58 +0000 (18:52 +0100)]
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

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

(cherry picked from commit e77bd9d64fc696cadfe1f8c9ebb50d7609a97b07)

20 months agoTests: Skip jQuery.Deferred.exceptionHook tests in IE 9
Michał Gołębiowski-Owczarek [Wed, 15 Mar 2023 11:21:35 +0000 (12:21 +0100)]
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

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

(cherry picked from commit cff2899885c314d32eea42e9eef6ead6e5da5c2f)

20 months agoDeferred: Rename `getStackHook` to `getErrorHook` (3.x version)
Michał Gołębiowski-Owczarek [Tue, 14 Mar 2023 21:32:57 +0000 (22:32 +0100)]
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

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

Close gh-5220

21 months agoSelector: Stop relying on CSS.supports( "selector(...)" )
Michał Gołębiowski-Owczarek [Tue, 14 Feb 2023 10:42:29 +0000 (11:42 +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-5207
Ref gh-5206
Ref gh-5098
Ref gh-5107
Ref w3c/csswg-drafts#7676

21 months agoSelector: Rename rcombinators to rleadingCombinator
Michał Gołębiowski-Owczarek [Mon, 13 Feb 2023 17:35:02 +0000 (18:35 +0100)]
Selector: Rename rcombinators to rleadingCombinator

Closes gh-5208

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>
(cherry picked from commit 7e7bd062070b3eca8ee047136ea8575fbed5d70f)

21 months agoTests: Fix selector tests in Chrome
Michał Gołębiowski-Owczarek [Tue, 24 Jan 2023 10:49:51 +0000 (11:49 +0100)]
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`.

22 months agoBuild: Run GitHub Action browser tests on Playwright WebKit
Michał Gołębiowski-Owczarek [Mon, 23 Jan 2023 22:49:44 +0000 (23:49 +0100)]
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 b02a257f98688aa890e06a85672cd1a54c3ffa3a)

22 months agoBuild: Migrate middleware-mockserver to modern JS
Michał Gołębiowski-Owczarek [Mon, 23 Jan 2023 22:20:08 +0000 (23:20 +0100)]
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 ce90a48450ba40586a6567235abb8fd2df84da97)

23 months agoDocs: Remove stale badge from README
Timmy Willison [Mon, 24 Oct 2022 15:00:25 +0000 (11:00 -0400)]
Docs: Remove stale badge from README

Close gh-5148

(cherry picked from commit bcd9c2bc3ddaa04f89f550681ca9c1ec5efc4328)

23 months agoDocs: update irc to Libera and fix LAMP dead link
fecore1 [Sun, 5 Sep 2021 19:23:59 +0000 (03:23 +0800)]
Docs: update irc to Libera and fix LAMP dead link

(cherry picked from commit 175db73ec7938e774d9e93d3afdfb35a24466b47)

23 months agoBuild: remove stale Insight package from custom builds
Timmy Willison [Tue, 20 Dec 2022 20:53:36 +0000 (20:53 +0000)]
Build: remove stale Insight package from custom builds

Close gh-5181

23 months agoTests: Skip the native :valid tests in IE 9
Michał Gołębiowski-Owczarek [Mon, 19 Dec 2022 18:56:49 +0000 (19:56 +0100)]
Tests: Skip the native :valid tests in IE 9

A newly added test making sure a native selector containing
the `:valid` pseudo works when no jQuery-specific selectors
are used was failing in IE 9 as that browser lacks support
for this pseudo. This commit disables that test in IE 9.

Ref gh-5178

23 months agoSelector: Make selector lists work with `qSA` again
Michał Gołębiowski-Owczarek [Mon, 19 Dec 2022 17:43:30 +0000 (18:43 +0100)]
Selector: Make selector lists work with `qSA` again

jQuery 3.6.2 started using `CSS.supports( "selector(SELECTOR)" )` before using
`querySelectorAll` on the selector. This was to solve gh-5098 - some selectors,
like `:has()`, now had their parameters parsed in a forgiving way, meaning
that `:has(:fakepseudo)` no longer throws but just returns 0 results, breaking
that jQuery mechanism.

A recent spec change made `CSS.supports( "selector(SELECTOR)" )` always use
non-forgiving parsing, allowing us to use this API for what we've used
`try-catch` before.

To solve the issue on the spec side for older jQuery versions, `:has()`
parameters are no longer using forgiving parsing in the latest spec update
but our new mechanism is more future-proof anyway.

However, the jQuery implementation has a bug - in
`CSS.supports( "selector(SELECTOR)" )`, `SELECTOR` needs to be
a `<complex-selector>` and not a `<complex-selector-list>`. Which means that
selector lists now skip `qSA` and go to the jQuery custom traversal:
```js
CSS.supports("selector(div:valid, span)"); // false
CSS.supports("selector(div:valid)"); // true
CSS.supports("selector(span)"); // true
```

To solve this, this commit wraps the selector list passed to
`CSS.supports( "selector(:is(SELECTOR))" )` with `:is`, making it a single
selector again.

See:
* https://w3c.github.io/csswg-drafts/css-conditional-4/#at-supports-ext
* https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector
* https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector-list

Fixes gh-5177
Closes gh-5178
Ref w3c/csswg-drafts#7280

(cherry picked from commit 09d988b774e7ff4acfb69c0cde2dab373559aaca)

23 months agoSelector: Implement the `uniqueSort` chainable method
Michał Gołębiowski-Owczarek [Mon, 28 Nov 2022 17:10:33 +0000 (18:10 +0100)]
Selector: Implement the `uniqueSort` chainable method

Some APIs, like `.prevAll()`, return elements in the reversed order, causing
confusing behavior when used with wrapping methods (see gh-5149 for more info)
 To provide an easy workaround, this commit implements a chainable `uniqueSort`
method on jQuery objects, an equivalent of `jQuery.uniqueSort`.

Fixes gh-5166
Closes gh-5168

(cherry picked from commit 5266f23cf49c9329bddce4d4af6cb5fbbd1e0383)

23 months agoSelector: Inline Sizzle into the selector module: 3.x version (#5113)
Michał Gołębiowski-Owczarek [Wed, 14 Dec 2022 00:41:31 +0000 (01:41 +0100)]
Selector: Inline Sizzle into the selector module: 3.x version (#5113)

This commit removes Sizzle from jQuery, inlining its code & removing obsolete
workarounds where applicable.

The Sizzle AUTHORS.txt file has been merged with the jQuery one - people are
sorted by their first contributions to either of the two repositories.

The main `selector` module can be disabled in favor of `selector-native`
via:

    grunt custom:-selector

For backwards compatibility, the legacy `sizzle` alias is also supported (it
will be dropped in jQuery `4.0.0`):

    grunt custom:-selector

Sizzle tests have been ported to jQuery ones. Ones that are not compatible
with the `selector-native` module are disabled if the regular selector module
is excluded.

Backwards compatibility is still kept for all `Sizzle` utils - they continue to be
available under `jQuery.find` - but the primary implementation is now attached
directly to jQuery.

Some selector utils shared by `selector` & `selector-native` have been
extracted & deduplicated. `jQuery.text` and `jQuery.isXMLDoc` have been
moved to the `core` module.

The commit reduces the gzipped jQuery size by 851 bytes compared to the
`3.x-stable` branch.

Closes gh-5113
Ref gh-4395
Ref gh-4406

23 months agoBuild: Updating the 3.x-stable version to 3.7.0-pre.
Michał Gołębiowski-Owczarek [Tue, 13 Dec 2022 23:48:46 +0000 (00:48 +0100)]
Build: Updating the 3.x-stable version to 3.7.0-pre.

23 months agoBuild: Updating the 3.x-stable version to 3.6.3-pre.
Timmy Willison [Tue, 13 Dec 2022 14:58:45 +0000 (09:58 -0500)]
Build: Updating the 3.x-stable version to 3.6.3-pre.

23 months agoRelease: update authors
Timmy Willison [Tue, 13 Dec 2022 01:55:26 +0000 (20:55 -0500)]
Release: update authors

23 months agoBuild: Limit permissions for GitHub workflows
Alex [Thu, 1 Dec 2022 13:23:17 +0000 (15:23 +0200)]
Build: Limit permissions for GitHub workflows

Add explicit permissions section[^1] to workflows. This is a security
best practice because by default workflows run with extended set
of permissions[^2] (except from `on: pull_request` from external forks[^3].
By specifying any permission explicitly all others are set to none. By using
the principle of least privilege the damage a compromised workflow can do
(because of an injection[^4] or compromised third party tool or action) is
restricted. It is recommended to have most strict permissions on the top
level[^5] and grant write permissions on job level[^6] on a case by case
basis.

[^1]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
[^2]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
[^3]: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
[^4]: https://securitylab.github.com/research/github-actions-untrusted-input/
[^5]: https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
[^6]: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

Closes gh-5119

(cherry picked from commit c909d6b1ff444e68618b6da13d9c21714f681925)

2 years agoBuild: Test on Node.js 18 & 19, stop testing on Node 12
Michał Gołębiowski-Owczarek [Thu, 17 Nov 2022 12:22:38 +0000 (13:22 +0100)]
Build: Test on Node.js 18 & 19, stop testing on Node 12

Closes gh-5161

2 years agoSelector:Manipulation: Fix DOM manip within template contents
Michał Gołębiowski-Owczarek [Tue, 15 Nov 2022 14:43:18 +0000 (15:43 +0100)]
Selector:Manipulation: Fix DOM manip within template contents

The `<template/>` element `contents` property is a document fragment that may
have a `null` `documentElement`. In Safari 16 this happens in more cases due
to recent spec changes - in particular, even if that document fragment is
explicitly adopted into an outer document. We're testing both of those cases
now.

The crash used to happen in `jQuery.contains` which is an alias for
`Sizzle.contains` in jQuery 3.x.

The Sizzle fix is at jquery/sizzle#490, released in Sizzle `2.3.8`. This
version of Sizzle is included in the parent commit.

A fix similar to the one from gh-5158 has also been applied here to the
`selector-native` version.

Fixes gh-5147
Closes gh-5159
Ref jquery/sizzle#490
Ref gh-5158

2 years agoSelector: Update Sizzle from 2.3.7 to 2.3.8
Michał Gołębiowski-Owczarek [Wed, 16 Nov 2022 15:56:10 +0000 (16:56 +0100)]
Selector: Update Sizzle from 2.3.7 to 2.3.8

Fixes gh-5147
Ref gh-5158
Ref jquery/sizzle#490

2 years agoBuild: Bump actions/setup-node from 3.5.0 to 3.5.1
dependabot[bot] [Tue, 1 Nov 2022 19:58:52 +0000 (20:58 +0100)]
Build: Bump actions/setup-node from 3.5.0 to 3.5.1

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

Closes gh-5153

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

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 0208224b5b76d54a39986f78aac97dbf1cccbe38)

2 years agoSelector: Update Sizzle from 2.3.6 to 2.3.7
Michał Gołębiowski-Owczarek [Tue, 4 Oct 2022 16:02:52 +0000 (18:02 +0200)]
Selector: Update Sizzle from 2.3.6 to 2.3.7

Fixes gh-5098
Closes gh-5135
Ref jquery/sizzle#486
Ref gh-5107

2 years agoBuild: Update Grunt from 1.4.1 to 1.5.3
Michał Gołębiowski-Owczarek [Mon, 3 Oct 2022 21:06:37 +0000 (23:06 +0200)]
Build: Update Grunt from 1.4.1 to 1.5.3

This will resolve the following security issues:
* Path Traversal in Grunt: https://github.com/advisories/GHSA-j383-35pm-c5h4
* Race Condition in Grunt: https://github.com/advisories/GHSA-rm36-94g8-835r

Closes gh-5134

(cherry picked from commit aa231cd21421503d319ad6068e7df0fb3baa7fea)

2 years agoDocs: Update the README of the published package
Michał Gołębiowski-Owczarek [Mon, 3 Oct 2022 20:55:49 +0000 (22:55 +0200)]
Docs: Update the README of the published package

The previous details were showing their age, e.g. mentions about browsers
not supporting ES2015. The story with ES modules is more complex as it's also
about loaders but to keep the README simple, let's just make it more up to date
with typical usage.

Closes gh-5108

(cherry picked from commit edccabf10d37b57cbd4eeebc44f3acb67cb2739c)

2 years agoTests: Remove a workaround for a Firefox XML parsing issue
Michał Gołębiowski-Owczarek [Mon, 3 Oct 2022 20:53:39 +0000 (22:53 +0200)]
Tests: Remove a workaround for a Firefox XML parsing issue

Firefox 96-100 used to report the column number smaller by 2 than it should
in the `parsererror` element generated for invalid XML documents. Since that
version range is unsupported now and it includes no ESR versions, the workaround
can now be dropped.

Closes gh-5109
Ref gh-5018

(cherry picked from commit e7ffe1f135dfa68ce3065b2bd319a29a57866dc6)

2 years agoCSS: Return `undefined` for whitespace-only CSS variable values (#5120)
Michał Gołębiowski-Owczarek [Mon, 3 Oct 2022 16:10:42 +0000 (18:10 +0200)]
CSS: Return `undefined` for whitespace-only CSS variable values (#5120)

The spec requires that CSS variable values are trimmed. In browsers that do
this - mainly, Safari, but also Firefox if the value only has leading
whitespace - we currently return undefined; in other browsers, we return
an empty string as the logic to fall back to undefined happens before
trimming.

This commit adds another explicit callback to `undefined` to have it consistent
across browsers.

Also, more explicit comments about behaviors we need to work around in various
browsers have been added.

Closes gh-5120
Ref gh-5106

(cherry picked from commit 7eb0019640a5856c42b451551eb7f995d913eba9)

2 years agoBuild: Bump actions/setup-node from 3.4.1 to 3.5.0
dependabot[bot] [Mon, 3 Oct 2022 14:58:47 +0000 (16:58 +0200)]
Build: Bump actions/setup-node from 3.4.1 to 3.5.0

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3.4.1...v3.5.0)

Closes gh-5133

---
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>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 25400750fb2e08b0a7e1a752a3ca0e9eaec16163)

2 years agoTests: Make Ajax tests pass in iOS 9
Michał Gołębiowski-Owczarek [Wed, 21 Sep 2022 15:46:18 +0000 (17:46 +0200)]
Tests: Make Ajax tests pass in iOS 9

Accept "HTTP/2.0 200" as a valid `statusText` for successful requests
to make ajax tests pass in iOS 9. At this point, normalizing this in code
doesn't seem to make a lot of sense.

Closes gh-5121

2 years agoCSS: Don’t trim whitespace of undefined custom property
Anders Kaseorg [Mon, 19 Sep 2022 21:08:12 +0000 (14:08 -0700)]
CSS: Don’t trim whitespace of undefined custom property

Fixes gh-5105
Closes gh-5106

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
(cherry picked from commit ed306c0261ab63746040e5d58bb4477c3069a427)

2 years agoUpgrade: Bump actions/setup-node from 3.3.0 to 3.4.1
dependabot[bot] [Mon, 12 Sep 2022 13:45:20 +0000 (15:45 +0200)]
Upgrade: Bump actions/setup-node from 3.3.0 to 3.4.1

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.3.0 to 3.4.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3.3.0...v3.4.1)

Closes gh-5078

(cherry picked from commit 78321f078ce04ce78aeade8e2860ac41d05fae54)

---
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>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoBuild: Updating the 3.x-stable version to 3.6.2-pre.
Timmy Willison [Fri, 26 Aug 2022 17:54:28 +0000 (13:54 -0400)]
Build: Updating the 3.x-stable version to 3.6.2-pre.

2 years agoRelease: update AUTHORS.txt
Timmy Willison [Mon, 15 Aug 2022 15:54:39 +0000 (11:54 -0400)]
Release: update AUTHORS.txt

2 years agoDeprecated: Improve $.trim performance for strings with lots of whitespace
Vladimir Sitnikov [Wed, 20 Jul 2022 08:51:13 +0000 (11:51 +0300)]
Deprecated: Improve $.trim performance for strings with lots of whitespace

Regex imp implementation takes `O(N^2)` time to trim the string when
multiple adjacent spaces were present.

The new expression require that the "whitespace run" starts from
a non-whitespace to avoid `O(N^2)` behavior when the engine would
try matching `\s+$` at each space position.

Closes gh-5068

2 years agoDocs: Update webpack website in README
Simon Legner [Tue, 12 Jul 2022 15:16:24 +0000 (17:16 +0200)]
Docs: Update webpack website in README

Webpack has migrated to https://webpack.js.org/ since version 2.

Closes gh-5037

(cherry picked from commit 01819bc3bcc44282e5bb9301c3478d837d1e5152)

2 years agoTests: Exclude tests based on compilation flags, not API presence (3.x version)
Michał Gołębiowski-Owczarek [Tue, 12 Jul 2022 15:12:27 +0000 (17:12 +0200)]
Tests: Exclude tests based on compilation flags, not API presence (3.x version)

Introduces a new test API, `includesModule`. The method returns whether
a particular module like "ajax" or "deprecated" is included in the current
jQuery build; it handles the slim build as well. The util was created so that
we don't treat presence of particular APIs to decide whether to run a test as
then if we accidentally remove an API, the tests would still not fail.

Closes gh-5071
Fixes gh-5069
Ref gh-5046

(partially cherry picked from commit fae5fee8b435cc20352d28b0a384b9784b1ad9ed)

2 years agoBuild: Update GitHub Actions
Michał Gołębiowski-Owczarek [Mon, 27 Jun 2022 16:53:31 +0000 (18:53 +0200)]
Build: Update GitHub Actions

* Build(deps): Bump actions/cache from 2 to 3

Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [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/v2...v3)

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

* Build(deps): Bump actions/setup-node from 2.1.2 to 3.3.0

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.1.2 to 3.3.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.2...v3.3.0)

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

* Build(deps): Bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 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/v2...v3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Closes gh-5067

(cherry picked from commit 52f452b2e8881e5ec5c9e880e277c8ecf633e8dc)

2 years agoBuild: Add dependabot.yml config (GitHub Actions)
Christian Oliff [Mon, 27 Jun 2022 16:33:41 +0000 (01:33 +0900)]
Build: Add dependabot.yml config (GitHub Actions)

This makes dependabot issue automated PRs to update
GitHub Action versions monthly.

Closes gh-5057

(cherry picked from commit 3f8bb2a46daf76f1427f49810d06a210ffbc7016)

2 years agoBuild: Test on Node 17, update Grunt & `karma-*` packages
Michał Gołębiowski-Owczarek [Mon, 14 Mar 2022 16:58:41 +0000 (17:58 +0100)]
Build: Test on Node 17, update Grunt & `karma-*` packages

This adds testing on Node.js 17 in addition to the currently tested 10, 12, 14
and 16 versions.

Also, update Grunt & `karma-*` packages.

Testing in Karma on jsdom is broken in Node 17 at the moment; until we find
a fix, this change disables such testing on Node 17 or newer.

Node smoke tests & promises aplus tests are disabled on Node.js 10 as they
depend on jsdom and the latest jsdom version doesn't run properly on Node 10.

Closes gh-5023

(cherry picked from commit 2525cffc42934c0d5c7aa085bc45dd6a8282e840)

2 years agoTests: Workaround an XML parsing bug in Firefox
Michał Gołębiowski-Owczarek [Mon, 28 Feb 2022 17:26:53 +0000 (18:26 +0100)]
Tests: Workaround an XML parsing bug in Firefox

See https://bugzilla.mozilla.org/show_bug.cgi?id=1751796

Closes gh-5018

(cherry picked from commit af1cd6f218f699abc34b1582a910c0df00312aee)

2 years agoDocs: add link to preview the new CLAs
Timmy Willison [Mon, 7 Feb 2022 17:09:55 +0000 (12:09 -0500)]
Docs: add link to preview the new CLAs

Closes gh-5010

2 years agoCSS: Skip falsy values in `addClass( array )`, compress code
Michał Gołębiowski-Owczarek [Mon, 24 Jan 2022 17:56:49 +0000 (18:56 +0100)]
CSS: Skip falsy values in `addClass( array )`, compress code

This change makes jQuery skip falsy values in `addClass( array )`
& `removeClass( array )` instead of stopping iteration when the first falsy
value is detected. This makes code like:
```js
elem.addClass( [ "a", "", "b" ] );
```
add both the `a` & `b` classes.

The code was also optimized for size a bit so it doesn't increase the
minified gzipped size.

Fixes gh-4998
Closes gh-5003

(partially cherry picked from commit a338b407f2479f82df40635055effc163835183f)

2 years agoDocs: Replace `#NUMBER` Trac issue references with `trac-NUMBER`
Michał Gołębiowski-Owczarek [Wed, 12 Jan 2022 22:23:10 +0000 (23:23 +0100)]
Docs: Replace `#NUMBER` Trac issue references with `trac-NUMBER`

This is a version of gh-4993 for the `3.x-stable` branch.

The GitHub UI treats `#NUMBER` as referring to its own issues which is confusing
when in jQuery source it's usually referring to the old deprecated Trac instance
at https://bugs.jquery.com. This change replaces all such Trac references with
`trac-NUMBER`.

A few of the references came with the Sizzle integration and referred to the
Sizzle GitHub bug tracker. Those have been replaced with full links instead.

A new entry describing issue reference conventions has been added to README.

Closes gh-4994
Ref gh-4993
Ref 5d5ea015114092c157311c4948f7cc3d8c8e7f8a

2 years agoTests: lock colors version to 1.4.0
Timmy Willison [Mon, 10 Jan 2022 20:40:24 +0000 (15:40 -0500)]
Tests: lock colors version to 1.4.0

2 years agoDocs: remove expired links from old jquery source 4999/head
Timmy Willison [Fri, 7 Jan 2022 17:41:21 +0000 (12:41 -0500)]
Docs: remove expired links from old jquery source

Ref gh-4981
Ref gh-4991

2 years agoDocs: Remove links to Web Archive from source
Michał Gołębiowski-Owczarek [Tue, 4 Jan 2022 15:33:43 +0000 (16:33 +0100)]
Docs: Remove links to Web Archive from source

Neither of the removed links is crucial; one of them refers to a site that has
since started being malicious; while the Web Archive links remain safe, some
scanners warn about such links. Removing them is the safest thing to do.

Fixes gh-4981
Closes gh-4991

(cherry picked from commit e24f2dcf3f6bda1a672502e0233c732065cbbe89)

2 years agoBuild: Separate the install step from running tests in GitHub Actions
Michał Gołębiowski-Owczarek [Tue, 4 Jan 2022 15:27:42 +0000 (16:27 +0100)]
Build: Separate the install step from running tests in GitHub Actions

Also, update the "Run test" label to "Run tests".

Closes gh-4992

(cherry picked from commit eef972508c8be6cc3cd0039d34dc9fe16bac916c)

2 years agoCSS: Justify use of rtrim on CSS property values
Richard Gibson [Mon, 3 Jan 2022 12:28:49 +0000 (07:28 -0500)]
CSS: Justify use of rtrim on CSS property values

CSS does not acknowledge carriage return or form feed characters
as whitespace but it does replace them with whitespace, making it
acceptable to use `rtrim`.

Closes gh-4956

(cherry picked from commit 655c0ed5e204b1f6427e09d615a49586a7bc84eb)

2 years agoBuild: remove travis.yml and travis mentions from core (#4984)
Timmy Willison [Mon, 13 Dec 2021 17:22:34 +0000 (12:22 -0500)]
Build: remove travis.yml and travis mentions from core (#4984)

We've migrate jquery core to GH actions and have already disabled core builds on travis

2 years agoTests: Skip ETag AJAX tests on TestSwarm
Michał Gołębiowski-Owczarek [Wed, 1 Dec 2021 11:46:33 +0000 (12:46 +0100)]
Tests: Skip ETag AJAX tests on TestSwarm

TestSwarm is now proxied via Cloudflare which cuts out headers relevant for
ETag tests, failing them. We're still running those tests in Karma on Chrome
& Firefox (including Firefox ESR).

Closes gh-4974

(cherry picked from commit 00c060d1619d472a2d8c5b104ed76fa3afc2ce97)

2 years agoTests: Allow statusText to be "success" in AJAX tests
Michał Gołębiowski-Owczarek [Wed, 1 Dec 2021 11:46:17 +0000 (12:46 +0100)]
Tests: Allow statusText to be "success" in AJAX tests

In HTTP/2, status message is not supported and whatever is reported as
statusText differs between browsers. In Chrome & Safari it's "success", in
Firefox & IE it's "OK". So far "success" wasn't allowed. This made the tests
pass locally if you're running an HTTP/1.1 server but on TestSwarm which is
now proxied via an HTTP/2-equipped Cloudflare, the relevant test started failing
in Chrome & Safari.

Allow "success" to resolve the issue.

Closes gh-4973

(cherry picked from commit 19ced963c63372eae5aca9e1a4baec80b78a2b8e)

2 years agoBuild: Migrate CI to GitHub Actions 4979/head
ygj6 [Tue, 30 Nov 2021 23:02:57 +0000 (00:02 +0100)]
Build: Migrate CI to GitHub Actions

Closes gh-4800

(cherry picked from commit e23190e63cb121da79b92e6641a81a44dcea9252)

3 years agoDocs: Update the URL to the latest jQuery build in CONTRIBUTING.md
Michał Gołębiowski-Owczarek [Thu, 18 Nov 2021 21:54:34 +0000 (22:54 +0100)]
Docs: Update the URL to the latest jQuery build in CONTRIBUTING.md

It used to say https://code.jquery.com/jquery.js but that's a frozen URL
to jQuery 1.11.1. Let's switch that to the URL to the Git build, i.e.
https://releases.jquery.com/git/jquery-git.js.

Closes gh-4972

(cherry picked from commit 9bdb16cd19097da67950a707baac3980bda873f3)

3 years agoTests: Disable CSS Custom Properties tests in old Safari/iOS
Michał Gołębiowski-Owczarek [Mon, 15 Nov 2021 17:40:58 +0000 (18:40 +0100)]
Tests: Disable CSS Custom Properties tests in old Safari/iOS

Safari 9.1 & iOS 9.3 support CSS custom properties but that support
is buggy which crashes our tests. Disable those tests there.

See https://caniuse.com/css-variables

Closes gh-4966

3 years agoTests: Make Karma browser timeout larger than the QUnit one
Michał Gołębiowski-Owczarek [Fri, 29 Oct 2021 22:56:31 +0000 (00:56 +0200)]
Tests: Make Karma browser timeout larger than the QUnit one

Since the default Karma browser no activity timeout was lower than the QUnit
timeout, a single timing out test was interrupting the whole test run of
a browser.

The QUnit timeout is set to 1 minute so I set the Karma one to 2 minutes.

Closes gh-4943

(cherry picked from commit 4fd6912bfd8fffbfabc98a9b0789d28f10af0914)

3 years agoCSS: Remove a redundant extension from rtrimCSS inclusion in curCSS
Michał Gołębiowski-Owczarek [Mon, 18 Oct 2021 22:31:49 +0000 (00:31 +0200)]
CSS: Remove a redundant extension from rtrimCSS inclusion in curCSS

This breaks the AMD mode.

3 years agoCSS: Trim whitespace surrounding CSS Custom Properties values
fecore1 [Thu, 23 Sep 2021 11:35:18 +0000 (19:35 +0800)]
CSS: Trim whitespace surrounding CSS Custom Properties values

The spec has recently changed and CSS Custom Properties values are trimmed now.
This change makes jQuery polyfill that new behavior for all browsers.

Ref w3c/csswg-drafts#774
Fixes gh-4926
Closes gh-4930

(partially cherry picked from commit efadfe991a5c287af561a9326bf1427d726c91c1)

3 years agoDocs: Remove the CLA checkbox in the pull request template
Michał Gołębiowski-Owczarek [Mon, 18 Oct 2021 16:09:04 +0000 (18:09 +0200)]
Docs: Remove the CLA checkbox in the pull request template

The EasyCLA status check is required so this won't get missed. The old JSF CLA
is dead, the provided link doesn't return meaningful information. There's no
good replacement link for the old CLA; PR authors are just supposed to sign the
new CLA by clicking on a link posted by the EasyCLA bot when they submit their
first PR since EasyCLA was enabled for the repo.

Closes gh-4937

(cherry picked from commit e124893132d7a979d7987f978e968a1f889348b6)

3 years agoTests: Don't remove csp.log in the cspClean action of mock.php 4954/head
Michał Gołębiowski-Owczarek [Wed, 29 Sep 2021 22:08:47 +0000 (00:08 +0200)]
Tests: Don't remove csp.log in the cspClean action of mock.php

For some reason the current setup worked fine with Apache but broke for me when
I migrated to nginx.

Closes gh-4936

(cherry picked from commit 1019074f7b1df96ee9d6409ada3dc0562046f6c7)

3 years agoTests: Load the TestSwarm listener via HTTPS
Michał Gołębiowski-Owczarek [Wed, 29 Sep 2021 13:28:52 +0000 (15:28 +0200)]
Tests: Load the TestSwarm listener via HTTPS

(cherry picked from commit d225639a8ea62863482bd20249077688f60235db)

3 years agoManipulation: Don't remove HTML comments from scripts
Michał Gołębiowski-Owczarek [Mon, 19 Jul 2021 17:15:27 +0000 (19:15 +0200)]
Manipulation: Don't remove HTML comments from scripts

When evaluating scripts, jQuery strips out the possible wrapping HTML comment
and a CDATA section. However, all supported browsers are already doing that
when loading JS via appending a script tag to the DOM which is how we've been
doing `jQuery.globalEval` since jQuery 3.0.0. jQuery logic was imperfect, e.g.
it just stripped the `<!--` and `-->` markers, respectively at the beginning or
the end of the script contents. However, browsers are also stripping everything
following those markers in the same line, treating them as single-line comments
delimiters; this is now also mandated by ECMAScript 2015 in Annex B. Instead
of fixing the jQuery logic, just let the browser do its thing.

We still need to strip CDATA sections for backwards compatibility. This
shouldn't be needed as in XML documents they're already not visible when
inspecting element contents and in HTML documents they have no meaning but
we're preserving that logic for backwards compatibility. This will be removed
completely in 4.0.

Fixes gh-4904
Closes gh-4905
Ref gh-4906

3 years agoBuild: Test on Node.js 16 instead of 15
Michał Gołębiowski-Owczarek [Mon, 12 Jul 2021 16:34:56 +0000 (18:34 +0200)]
Build: Test on Node.js 16 instead of 15

Node.js 10 is kept for now despite being EOL'd as that's what our current
infrastructure relies on.

Closes gh-4902

(cherry picked from commit 0f623fdc8db128657716290cb7d57430e224c977)

3 years agoTests: Switch background image from online file to local 1x1.jpg
Timo Tijhof [Mon, 24 May 2021 16:23:50 +0000 (17:23 +0100)]
Tests: Switch background image from online file to local 1x1.jpg

Also, remove unused `expected` property in `css` test cases.

Closes gh-4866

(cherry picked from commit 482f846203e82b1c2620f580e483bf41d11f9f49)

3 years agoEvent: Don't break focus triggering after `.on(focus).off(focus)`
Michał Gołębiowski-Owczarek [Mon, 10 May 2021 16:59:14 +0000 (18:59 +0200)]
Event: Don't break focus triggering after `.on(focus).off(focus)`

The `_default` function in the special event settings for focus/blur has
always returned `true` since gh-4813 as the event was already being fired
from `leverageNative`. However, that only works if there's an active handler
on that element; this made a quick consecutive call:

```js
elem.on( "focus", function() {} ).off( "focus" );
```

make subsequent `.trigger( "focus" )` calls to not do any triggering.

The solution, already used in a similar `_default` method for the `click` event,
is to check for the `dataPriv` entry on the element for the focus event
(similarly for blur).

Fixes gh-4867
Closes gh-4885

(cherry picked from commit e539bac79e666bba95bba86d690b4e609dca2286)

3 years agoBuild: Take core-js from the external directory as well
Michał Gołębiowski-Owczarek [Tue, 13 Apr 2021 20:10:09 +0000 (22:10 +0200)]
Build: Take core-js from the external directory as well

All the other files were already taken from the external directory.
The fact core-js was taken from node_modules broke IE core tests on TestSwarm.

Ref gh-4865
Ref gh-4870

(partially cherry picked from 345cd22e5664655ed315958ed2056610607c12ef)

3 years agoTests: Strip untypical callback parameter characters from mock.php
Michał Gołębiowski-Owczarek [Tue, 13 Apr 2021 20:13:48 +0000 (22:13 +0200)]
Tests: Strip untypical callback parameter characters from mock.php

Only allow alphanumeric characters & underscores for callback parameters.
The change is done both for the PHP server as well as the Node.js-based version.
This is only test code so we're not fixing any security issue but it happens
often enough that the whole jQuery repository directory structure is deployed
onto the server with PHP enabled that it makes is easy to introduce security
issues if this cleanup is not done.

Ref gh-4764
Closes gh-4871

(cherry picked from a70274632dc19ff4a64d7bb7657a2cc647ff38b9)

3 years agoBuild: Updating the 3.x-stable version to 3.6.1-pre.
Timmy Willison [Tue, 2 Mar 2021 17:12:18 +0000 (12:12 -0500)]
Build: Updating the 3.x-stable version to 3.6.1-pre.

3 years agoRelease: remove the need to install grunt globally
Timmy Willison [Mon, 1 Mar 2021 22:48:55 +0000 (17:48 -0500)]
Release: remove the need to install grunt globally

3 years agoRelease: update version to 3.6.0-pre
Timmy Willison [Mon, 1 Mar 2021 22:44:10 +0000 (17:44 -0500)]
Release: update version to 3.6.0-pre

3 years agoRelease: drop the need for npm as a local dependency
Timmy Willison [Mon, 1 Mar 2021 22:41:18 +0000 (17:41 -0500)]
Release: drop the need for npm as a local dependency

- Not meant to be used like that anymore

3 years agoRelease: upgrade release dependencies
Timmy Willison [Mon, 1 Mar 2021 21:48:41 +0000 (16:48 -0500)]
Release: upgrade release dependencies

3 years agoRelease: update AUTHORS.txt
Timmy Willison [Mon, 1 Mar 2021 19:40:03 +0000 (14:40 -0500)]
Release: update AUTHORS.txt

3 years agoSelector: Update Sizzle from 2.3.5 to 2.3.6
Michał Gołębiowski-Owczarek [Wed, 17 Feb 2021 21:19:56 +0000 (22:19 +0100)]
Selector: Update Sizzle from 2.3.5 to 2.3.6

Fixes gh-4782
Close gh-4846

3 years agoSupport: ensure display is set to block for the support div (#4844)
Timmy Willison [Tue, 16 Feb 2021 19:34:14 +0000 (14:34 -0500)]
Support: ensure display is set to block for the support div (#4844)

- Fixes an issue with the support test in iframes in Android 8 Chrome 86+,
  where display: inline resulted in unexpected height values.

Fixes gh-4832

3 years agoBuild: Rename master to main across the repository
Michał Gołębiowski-Owczarek [Fri, 5 Feb 2021 21:00:56 +0000 (22:00 +0100)]
Build: Rename master to main across the repository

The default branch was updated, this updates the remaining occurrences in code
& comments.

Closes gh-4838

(cherry picked from commit 8ae477a432f0924cd4bd3bdeaef2c4c15e483a8f)

3 years agoDeferred: Rename master to primary
Michał Gołębiowski-Owczarek [Tue, 12 Jan 2021 19:56:51 +0000 (20:56 +0100)]
Deferred: Rename master to primary

Closes gh-4828

(cherry picked from a32cf6324f8f2190e66a687e94be9687ebf840b7)

3 years agoTests: Fix tests for not auto-executing scripts without dataType
Michał Gołębiowski-Owczarek [Mon, 11 Jan 2021 17:20:36 +0000 (18:20 +0100)]
Tests: Fix tests for not auto-executing scripts without dataType

Two issues are fixed in testing for responses with a script Content-Type not
getting auto-executed unless an explicit `dataType: "script"` is provided:
* the test is now using a correct "text/javascript" Content-Type; it was using
  "text/html" until now which doesn't really check if the fix works
* the Node.js based version of the tests didn't account for an empty `header`
  query string parameter

Closes gh-4824
Ref gh-2432
Ref gh-2588
Ref 39cdb8c9aa0fde68f733553ba050a2ba9d86474c

(cherry picked from commit d38528b17a846b7ca4513b41150a05436546292d)

3 years agoDimensions: Modify reliableTrDimensions support test to account for FF
Timmy Willison [Mon, 11 Jan 2021 16:56:38 +0000 (11:56 -0500)]
Dimensions: Modify reliableTrDimensions support test to account for FF

Firefox incorrectly (or perhaps correctly) includes table borders in computed
dimensions, but they are the only one. Workaround this by testing for it and
falling back to offset properties

Fixes gh-4529
Closes gh-4807

3 years agoTests: Skip the jQuery.parseXML error reporting test in Legacy Edge
Michał Gołębiowski-Owczarek [Tue, 8 Dec 2020 13:27:05 +0000 (14:27 +0100)]
Tests: Skip the jQuery.parseXML error reporting test in Legacy Edge

Legacy Edge, similarly to IE, doesn't report XML parsing errors but just tries
to render the invalid document. Skip the error reporting test there, Edge Legacy
will return a generic "Invalid XML" error, just like IE.

Ref gh-4816

3 years agoTests: Fix the jQuery.parseXML error reporting test
Michał Gołębiowski-Owczarek [Tue, 8 Dec 2020 11:02:10 +0000 (12:02 +0100)]
Tests: Fix the jQuery.parseXML error reporting test

Changes:
* Remove incorrect `QUnit.testUnlessIE` usage as that util is only available
  on `master`, not here.
* Change `firstCall.lastArg` to `firstCall.args[ 0 ]` as the former API is not
  available in older Sinon versions.

3 years agoCore: Report browser errors in parseXML
Michał Gołębiowski-Owczarek [Tue, 8 Dec 2020 10:22:21 +0000 (11:22 +0100)]
Core: Report browser errors in parseXML

Fixes gh-4784
Closes gh-4816

(cherry picked from commit 8969732518470a7f8e654d5bc5be0b0076cb0b87)

3 years agoEvent: Make focus re-triggering not focus the original element back
Michał Gołębiowski-Owczarek [Mon, 7 Dec 2020 19:28:44 +0000 (20:28 +0100)]
Event: Make focus re-triggering not focus the original element back

If during a focus handler another focus event is triggered:

```js
elem1.on( "focus", function() {
elem2.trigger( "focus" );
} );
```

due to their synchronous nature everywhere outside of IE the hack added in
gh-4279 to leverage native events causes the native `.focus()` method to be
called last for the initial element, making it steal the focus back. Since
the native method is already being called in `leverageNative`, we can skip that
final call.

This aligns with changes to the `_default` method for the `click` event that
were added when `leverageNative` was introduced there.

A side effect of this change is that now `focusin` will only propagate to the
document for the last focused element. This is a change in behavior but it also
aligns us better with how this works with native methods.

Fixes gh-4382
Closes gh-4813
Ref gh-4279

(cherry picked from commit dbcffb396c2db61ff96edc4162602e850797d61f)

4 years agoBuild: Fix Travis build on Node.js 15 with npm 7
Michał Gołębiowski-Owczarek [Tue, 17 Nov 2020 16:05:41 +0000 (17:05 +0100)]
Build: Fix Travis build on Node.js 15 with npm 7

The `grunt-karma` version we used required Karma 3.x and it's now enforced
in npm 7. Update a few Karma & Grunt-related packages to resolve the issue.

Closes gh-4810

4 years agoBuild: Test on Node.js 15
Michał Gołębiowski-Owczarek [Wed, 11 Nov 2020 22:02:22 +0000 (23:02 +0100)]
Build: Test on Node.js 15

Also, run browser tests on Node 14 instead of 12.

Closes gh-4802

(cherry-picked from 6984d1747623dbc5e87fd6c261a5b6b1628c107c)

4 years agoEvent: Don't crash if an element is removed on blur
Michał Gołębiowski-Owczarek [Mon, 19 Oct 2020 19:17:51 +0000 (21:17 +0200)]
Event: Don't crash if an element is removed on blur

In Chrome, if an element having a `focusout` handler is blurred by
clicking outside of it, it invokes the handler synchronously. If
that handler calls `.remove()` on the element, the data is cleared,
leaving private data undefined. We're reading a property from that
data so we need to guard against this.

Fixes gh-4417
Closes gh-4799

(cherry picked from commit 5c2d08704e289dd2745bcb0557b35a9c0e6af4a4)

4 years agoTests: Recognize callbacks with dots in the Node.js mock server
Michał Gołębiowski-Owczarek [Wed, 2 Sep 2020 16:42:52 +0000 (18:42 +0200)]
Tests: Recognize callbacks with dots in the Node.js mock server

This aligns the Node.js server with the previous PHP one in sending `mock.php`
as a callback if there's no `callback` parameter in the query string which is
triggered by a recently added test. This prevents the request crashing on that
Node.js server and printing a JS error:
```
TypeError: Cannot read property '1' of null
```

Closes gh-4764
Ref gh-4754

(cherry picked from commit df6858df2ed3fc5c424591a5e09b900eb4ce0417)

4 years agoTests: Skip the "jQuery.ajax() on unload" test in Safari
Michał Gołębiowski-Owczarek [Wed, 2 Sep 2020 16:04:44 +0000 (18:04 +0200)]
Tests: Skip the "jQuery.ajax() on unload" test in Safari

The test has been already skipped in Chrome as it dropped support for such
requests and now Safari has joined the squad.

This will resolve AJAX test errors we've had for a while in Safari 13 & iOS 13.

Closes gh-4779

(cherry picked from commit c18dc49699bc27481a4af36ed1a0ee1b19c6eb03)

4 years agoEvent: Remove the event.which shim
Michał Gołębiowski-Owczarek [Wed, 26 Aug 2020 12:10:33 +0000 (14:10 +0200)]
Event: Remove the event.which shim

All supported browsers implement this property by themselves. The shim was only
needed for IE <9.

Fixes gh-3235
Closes gh-4765
Ref gh-4755

(cherry picked from commit 1a5fff4c169dbaa2df72c656868bcf60ed4413d0)