Commit Graph

6541 Commits

Author SHA1 Message Date
Timo Tijhof
8d20cb9732 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 482f846203)
2021-05-24 18:30:54 +02:00
Michał Gołębiowski-Owczarek
b3e4a7eb16 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 e539bac79e)
2021-05-10 19:13:25 +02:00
Michał Gołębiowski-Owczarek
752b8981f8 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 345cd22e56)
2021-04-14 01:47:38 +02:00
Michał Gołębiowski-Owczarek
b14b62c8a2 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 a70274632d)
2021-04-13 22:36:19 +02:00
Timmy Willison
3642471ec5
Build: Updating the 3.x-stable version to 3.6.1-pre. 2021-03-02 12:12:18 -05:00
Timmy Willison
aed59da0c9
Release: remove the need to install grunt globally 2021-03-01 17:48:55 -05:00
Timmy Willison
8606ce4292
Release: update version to 3.6.0-pre 2021-03-01 17:44:10 -05:00
Timmy Willison
8b50fbe75d
Release: drop the need for npm as a local dependency
- Not meant to be used like that anymore
2021-03-01 17:41:18 -05:00
Timmy Willison
a21a4b2de7
Release: upgrade release dependencies 2021-03-01 16:48:41 -05:00
Timmy Willison
c208debdec
Release: update AUTHORS.txt 2021-03-01 14:40:03 -05:00
Michał Gołębiowski-Owczarek
165487406f
Selector: Update Sizzle from 2.3.5 to 2.3.6
Fixes gh-4782
Close gh-4846
2021-02-17 16:19:56 -05:00
Timmy Willison
f8bdb1270a
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
2021-02-16 14:34:14 -05:00
Michał Gołębiowski-Owczarek
627c573ac6 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 8ae477a432)
2021-02-05 23:21:21 +01:00
Michał Gołębiowski-Owczarek
15b62a2eb5 Deferred: Rename master to primary
Closes gh-4828

(cherry picked from a32cf6324f)
2021-01-12 21:04:59 +01:00
Michał Gołębiowski-Owczarek
7298e04fae 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 39cdb8c9aa

(cherry picked from commit d38528b17a)
2021-01-11 18:41:36 +01:00
Timmy Willison
bcd40aa7a3
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
2021-01-11 11:56:38 -05:00
Michał Gołębiowski-Owczarek
bf06dd477a 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
2020-12-08 14:27:05 +01:00
Michał Gołębiowski-Owczarek
1ec36332fc 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.
2020-12-08 12:05:41 +01:00
Michał Gołębiowski-Owczarek
54d98835b6 Core: Report browser errors in parseXML
Fixes gh-4784
Closes gh-4816

(cherry picked from commit 8969732518)
2020-12-08 11:34:50 +01:00
Michał Gołębiowski-Owczarek
2fadbc0a98 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 dbcffb396c)
2020-12-07 21:06:44 +01:00
Michał Gołębiowski-Owczarek
07829a1664
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
2020-11-17 17:05:41 +01:00
Michał Gołębiowski-Owczarek
0458f98eec Build: Test on Node.js 15
Also, run browser tests on Node 14 instead of 12.

Closes gh-4802

(cherry-picked from 6984d17476)
2020-11-11 23:04:31 +01:00
Michał Gołębiowski-Owczarek
aaf9c55ad2 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 5c2d08704e)
2020-10-19 21:21:54 +02:00
Michał Gołębiowski-Owczarek
4c572a7fee 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 df6858df2e)
2020-09-02 18:46:56 +02:00
Michał Gołębiowski-Owczarek
4f016c642c 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 c18dc49699)
2020-09-02 18:05:47 +02:00
Michał Gołębiowski-Owczarek
2bf9793efc 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 1a5fff4c16)
2020-08-26 14:19:24 +02:00
Dallas Fraser
3bae54aa50 Ajax: Execute JSONP error script responses
Issue gh-4379 was meant to be a bug fix but the JSONP case is a bit special:
under the hood it's a script but it simulates JSON responses in an environment
without a CORS setup and sending JSON payloads on error responses is quite
typical there.

This commit makes JSONP error responses still execute the payload. The regular
script error responses continue to be skipped.

Fixes gh-4771
Closes gh-4773

(cherry picked from commit a1e619b03a)
2020-08-25 21:43:02 +02:00
Wonhyoung Park
beea433d33 Tests: Remove an unused local variable
Closes gh-4769

(cherry picked from commit 82b87f6f0e)
2020-08-13 13:28:32 +02:00
Natalia Sroka
bf1430a7e6
Core: Bring back QtWebKit support for jQuery 3.x
Allow jQuery to recognize that DOM types such as HTMLCollection
or NodeList are not functions.

Fixes gh-4756
Closes gh-4757
2020-07-27 22:01:55 +02:00
Michał Gołębiowski-Owczarek
fe4098005e
Revert "Offset: Send px-ed strings to .css()"
The way warning against number values in `.css()` setters was done in
jquery/jquery-migrate#337 and later refined in jquery/jquery-migrate#348
there's no need to send px-ed strings for `top` & `left` as they already
don't get the "px" suffix.

This reverts commit 57038faebc.

Closes gh-4753
Ref jquery/jquery-migrate/pull/337
Ref jquery/jquery-migrate/pull/348
2020-07-20 21:29:40 +02:00
Beatriz Rezener
d32a7a524f Build: Fix commitplease husky config
Fixes gh-4735
Closes gh-4737

(cherry picked from commit 3a1b338a7a)
2020-07-20 19:12:28 +02:00
Michał Gołębiowski-Owczarek
25407dcaf5 Build: Update eslint-config-jquery, fix linting violations
Closes gh-4696
Ref jquery/eslint-config-jquery#15
Ref jquery/eslint-config-jquery#16

(cherry picked from commit ef4d6ca6c3)
2020-05-18 22:40:42 +02:00
Michał Gołębiowski-Owczarek
5e028c76f4 Tests: Remove remaining obsolete jQuery.cache references
PR gh-4586 removed some of those but not all.

Closes gh-4715
Ref gh-4586

(cherry picked from commit d96111e18b)
2020-05-18 18:53:26 +02:00
Michał Gołębiowski-Owczarek
8ad78cdbc4 Tests: Remove obsolete jQuery data tests
The tests relied on `jQuery.cache` so they only ever worked in jQuery 1.x.

Closes gh-4586

(cherry picked from commit eb35be528f)
2020-05-18 18:51:34 +02:00
Michał Gołębiowski-Owczarek
db43ef0bff Docs: Change JS Foundation mentions to OpenJS Foundation
Closes gh-4711

(cherry picked from 11611967ad)
2020-05-18 18:46:27 +02:00
Wonseop Kim
9b8cadc736 Build: Correct code indentations based on jQuery Style Guide
1. Correct code indentations based on jQuery Style Guide
   (contribute.jquery.org/style-guide/js/#spacing).
2. Add rules to "src/.eslintrc.json" to enable "enforcing consistent
   indentation", with minimal changes to the current code.

Closes gh-4672

(cherry picked from 3d62d57049)
2020-05-05 13:04:46 +02:00
Timmy Willison
9908b7aace
Build: Updating the 3.x-stable version to 3.5.2-pre. 2020-05-04 18:51:05 -04:00
Timmy Willison
7d2ce691cd
Release: update AUTHORS.txt 2020-05-04 17:51:40 -04:00
Michał Gołębiowski-Owczarek
ea2d0d50c0 Tests: Workaround failures in recent XSS tests in iOS 8 - 12
iOS 8-12 parses `<noembed>` tags differently, executing this code. This is no
different to native behavior on that OS, though, so just accept it.

Ref gh-4685
Closes gh-4694

(cherry picked from commit 11066a9e6a)
2020-04-30 21:26:18 +02:00
Pierre Grimaud
ea3766c081 Docs: Fix typos
Closes gh-4686

(cherry picked from commit 1a7332ce83)
2020-04-29 21:18:55 +02:00
Michał Gołębiowski-Owczarek
58a8e87979 Tests: Add tests for recently fixed manipulation XSS issues
Closes gh-4685
Ref gh-4642
Ref gh-4647

(cherry picked from commit dc06d68bdc)
2020-04-29 16:50:27 +02:00
Michał Gołębiowski-Owczarek
c1c0598d8f Tests: Cleanup window & document handlers in a new event test
The "focusin on document & window" test didn't cleanup `focusout` handlers
on `window` & `document`. This has been fixed.

Ref gh-4657
2020-04-27 22:00:41 +02:00
Michał Gołębiowski-Owczarek
46ba70c5e8 Tests: Fix flakiness in the "jQuery.ajax() - JSONP - Same Domain" test
The "jQuery.ajax() - JSONP - Same Domain" test is firing a request with
a duplicate "callback" parameter, something like (simplified):
```
mock.php?action=jsonp&callback=jQuery_1&callback=jQuery_2
```

There was a difference in how the PHP & Node.js implementations of the jsonp
action in the mock server handled situations like that. The PHP implementation
was using the latest parameter while the Node.js one was turning it into an
array but the code didn't handle this situation. Because of how JavaScript
stringifies arrays, while the PHP implementation injected the following code:
```js
jQuery_2(payload)
```
the Node.js one was injecting the following one:
```js
jQuery_1,jQuery_2(payload)
```
This is a comma expression in JavaScript; it so turned out that in the majority
of cases both callbacks were identical so it was more like:
```js
jQuery_1,jQuery_1(payload)
```
which evaluates to `jQuery_1(payload)` when `jQuery_1` is defined, making the
test go as expected. In many cases, though, especially on Travis, the callbacks
were different, triggering an `Uncaught ReferenceError` error & requiring
frequent manual re-runs of Travis builds.

This commit fixes the logic in the mock Node.js server, adding special handling
for arrays.

Closes gh-4687

(cherry picked from commit 7b0864d053)
2020-04-27 20:28:40 +02:00
Michał Gołębiowski-Owczarek
f7fed7eec2 Docs: Update the link to the jsdom repository
Closes gh-4684

(cherry picked from commit a62309e01b)
2020-04-25 20:48:34 +02:00
Michał Gołębiowski-Owczarek
205dd134b9 Build: Test on Node.js 14, stop testing on Node.js 8 & 13
Closes gh-4678

(cherry picked from commit 88eb22e059)
2020-04-23 14:15:19 +02:00
Ed S
b21d6710cf Build: Enable reportUnusedDisableDirectives in ESLint
This forbids unnecessary `eslint-disable` comments.

Ref gh-4095
Closes gh-4520

(cherry picked from 46f9810b73)
2020-04-20 19:06:13 +02:00
Michał Gołębiowski-Owczarek
65e909844c
Data: Make the data object a regular object again
The change in gh-4603 made the object returned by `elem.data()`
a prototype-less object. That's a desired change to support keys
colliding with `Object.prototype` properties but it's also a breaking
change so it has to wait for jQuery 4.0.0.

A 3.x-only test was added to avoid breaking it in the future on this
branch.

Fixes gh-4665
Ref gh-4603
Closes gh-4666
2020-04-20 18:11:18 +02:00
Jonathan
763dd3fefa Docs: Use https for hyperlinks in README
Closes gh-4673

(cherry picked from commit 73415da25d)
2020-04-17 11:48:38 +02:00
Michał Gołębiowski-Owczarek
898784ab84 Build: Updating the 3.x-stable version to 3.5.1-pre. 2020-04-10 17:47:07 +02:00
Michał Gołębiowski-Owczarek
8570a08f66 Release: Update AUTHORS.txt 2020-04-10 16:45:30 +02:00