Commit Graph

6521 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
1b74660f73 Release: Update AUTHORS.txt
After recent merging of Sizzle & jQuery AUTHORS.txt, the `grunt authors` task
doesn't provide meaningful as there's no obvious connection between current
AUTHORS.txt contents & the desired one. Adding two new entries should make it
easier (plus, it makes it possible to test jquery-release on current master).

Apart from that, the commit adds a missing .mailmap entry for Shashanka Nataraj.
2019-09-26 21:12:38 +02:00
Sean Robinson
50871a5a85 Ajax: Do not execute scripts for unsuccessful HTTP responses
The script transport used to evaluate fetched script sources which is
undesirable for unsuccessful HTTP responses. This is different to other data
types where such a convention was fine (e.g. in case of JSON).

Fixes gh-4250
Closes gh-4379
2019-09-26 02:43:30 +02:00
Ahmed.S.ElAfifi
9df4f1de12 Core: Use Array.prototype.flat where supported
Calling `Array.prototype.concat.apply( [], inputArray )` to flatten `inputArray`
crashes for large arrays; using `Array.prototype.flat` avoids these issues in
browsers that support it. In case it's necessary to support these large arrays
even in older browsers, a polyfill for `Array.prototype.flat` can be loaded.
This is already being done by many applications.

Fixes gh-4320
Closes gh-4459
2019-09-25 01:38:21 +02:00
Michał Gołębiowski-Owczarek
aa6344baf8
Selector: Use shallow document comparisons to avoid IE/Edge crashes
IE/Edge sometimes crash when comparing documents between frames using the strict
equality operator (`===` & `!==`). Funnily enough, shallow comparisons
(`==` & `!=`) work without crashing.

Fixes gh-4441
Closes gh-4471
2019-09-25 00:41:07 +02:00
Michał Gołębiowski-Owczarek
b59107f5d7
Core: Remove private copies of push, sort & splice from the jQuery prototype
Closes gh-4473
2019-09-24 02:12:36 +02:00
Michał Gołębiowski-Owczarek
78420d427c
Core: Implement .even() & .odd() to replace POS :even & :odd
`:even` & `:odd` are deprecated since jQuery 3.4.0 & will be removed in 4.0.0.
The new `even()` & `odd()` methods will make the migration easier.

Closes gh-4485
2019-09-24 02:04:53 +02:00
Michał Gołębiowski-Owczarek
f810080e8e Deprecated: Fix AMD parameter order
Ref gh-4461
2019-08-31 01:40:45 +02:00
Michał Gołębiowski-Owczarek
29a9544a4f
Selector: reduce size, simplify setDocument
With new selector code doing less convoluted support tests, it was possible
to extract a lot of logic out of setDocument & also reduce size.

This commit also backports jquery/sizzle#439 that was reverted by mistake
during a switch from JSHint + JSCS to ESLint.

Closes gh-4462
Ref jquery/sizzle#442
Ref jquery/sizzle#439
2019-08-26 19:15:53 +02:00
Michał Gołębiowski-Owczarek
abdc89ac2e
Ajax: Simplify jQuery.ajaxSettings.xhr
Previously, jQuery.ajaxSettings.xhr, contents were wrapped in a try-catch
as we defined jQuery.support.ajax & jQuery.support.cors executed during the
jQuery load and we didn't want to crash if IE had native XHR disabled (which
is possible). While jQuery hasn't supported the ActiveX-based XHR since 2.0,
jQuery with XHR disabled could still be used for its other features in such
a crippled browser.

Since gh-4347, jQuery.support.ajax & jQuery.support.cors no longer exist, so
we don't need the try-catch anymore.

Fixes gh-1967
Closes gh-4467
Ref gh-4347
2019-08-26 19:01:26 +02:00
Michał Gołębiowski-Owczarek
d7e64190ef
Build: Remove the external directory, read from node_modules directly
Now that Sizzle is gone & we use npm, we can read from node_modules directly
and skip the setup that copies some files to the external directory.

Closes gh-4466
2019-08-26 18:53:54 +02:00
Shashanka Nataraj
5ea5946094 Core: Deprecate jQuery.trim
Fixes gh-4363
Closes gh-4461
2019-08-22 02:06:26 +02:00
Richard Gibson
ac5f7cd8e2
Tests: Port changes from Sizzle
Ref https://github.com/jquery/sizzle/pull/450
Closes gh-4464
2019-08-20 14:05:37 -04:00
Michał Gołębiowski-Owczarek
df6a7f7f0f
Selector: Leverage the :scope pseudo-class where possible
The `:scope` pseudo-class[1] has surprisingly good browser support: Chrome,
Firefox & Safari have supported if for a long time; only IE & Edge lack support.
This commit leverages this pseudo-class to get rid of the ID hack in most cases.
Adding a temporary ID may cause layout thrashing which was reported a few times
in [the past.

We can't completely eliminate the ID hack in modern browses as sibling selectors
require us to change context to the parent and then `:scope` stops applying to
what we'd like. But it'd still improve performance in the vast majority of
cases.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/:scope

Fixes gh-4453
Closes gh-4454
Ref gh-4332
Ref jquery/sizzle#405
2019-08-19 18:41:03 +02:00
Michał Gołębiowski-Owczarek
7bdf307b51
Tests: Fix a comment in testinit.js
A copied comment line was accidentally left out above the line defining
`QUnit.jQuerySelectorsPos`, making the sentence nonsense. This commit removes
that line.

Closes gh-4458
2019-08-19 18:36:21 +02:00
Timmy Willison
b334ce7735
Tests: update npo.js and include unminified source instead
Close gh-4446
Ref gh-4445
2019-08-12 12:06:52 -04:00
Michał Gołębiowski-Owczarek
cef4b73179
Selector: Bring back querySelectorAll shortcut usage
Due to a faulty IE 8 workaround removal, the fast path qSA mode was skipped
when jQuery's find was called on an element node - i.e. in most cases. 😱

Ref gh-4395
Closes gh-4452
2019-08-09 12:42:05 +02:00
Michał Gołębiowski-Owczarek
47835965bd Selector: Inline Sizzle into the selector module
This commit removes Sizzle from jQuery, inlining its code & removing obsolete
workarounds where applicable.

The selector-native module has been removed. Further work on the selector
module may decrease the size enough that it will no longer be necessary. If
it turns out it's still useful, we'll reinstate it but the code will look
different anyway as we'll want to share as much code as possible with
the existing selector module.

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 commit reduces the gzipped jQuery size by 1460 bytes compared to master.

Closes gh-4395
2019-07-29 21:19:21 +02:00
Michał Gołębiowski-Owczarek
79b74e043a
Selector: Port Sizzle tests to jQuery
Apart from porting most Sizzle tests to jQuery (mostly to its selector module),
this commit fixes selector-native so that a jQuery custom compilation that
excludes Sizzle passes all tests as well.

Closes gh-4406
2019-06-26 21:39:10 +02:00
Michał Gołębiowski-Owczarek
438b1a3e8a
Build: ESLint: forbid unused function parameters
This commit requires all function parameters to be used, not just the last one.
In cases where that's not possible as we need to match an external API, there's
an escape hatch of prefixing an unused argument with `_`.

This change makes it easier to catch unused AMD dependencies and unused
parameters in internal functions the API of which we may change at will, among
other things.

Unused AMD dependencies have been removed as part of this commit.

Closes gh-4381
2019-05-13 22:25:11 +02:00
Michał Gołębiowski-Owczarek
9ec09c3b4a
Build: Fix the regex parsing AMD var-modules (#4389)
The previous regex caused the final jQuery binary to have syntax errors for
var-modules with names starting with "return". For example, the following module
wouldn't work when the file is named `returnTrue.js`:

```js
define( function() {
	"use strict";
	return function returnTrue() {
		return true;
	};
} );
```

Closes gh-4389
2019-05-13 21:55:45 +02:00
Michał Gołębiowski-Owczarek
3527a38405
Core: Remove IE-specific support tests, rely on document.documentMode
Also, update some tests to IE-sniff when deciding whether
to skip a test.

Fixes gh-4386
Closes gh-4387
2019-05-13 21:39:56 +02:00
Michał Gołębiowski-Owczarek
ccbd6b9342
Traversing: Fix contents() on <object>s with children in IE
The original fix didn't account for the fact that in IE `<object>` elements
with no `data` attribute have an object `contentDocument`. The fix leverages
the fact that this special object has a null prototype.

Closes gh-4390
Ref gh-4384
Ref gh-4385
2019-05-08 10:12:36 +02:00
Pat O'Callaghan
4d865d96aa Traversing: Fix contents() on <object>s with children
Fixes gh-4384
Closes gh-4385
2019-05-06 19:23:00 +02:00
Wonseop Kim
110802c7f2 Effect: Fix a unnecessary conditional statement in .stop()
Because of the above conditional, the 'type' variable has a value of type
'string' or undefined. Therefore, boolean comparisons for 'type' variable
is always unnecessary because it return true. The patch removed the
unnecessary conditional statement.

Fixes gh-4374
Closes gh-4375
2019-05-01 14:57:55 +02:00
Michał Gołębiowski-Owczarek
b220f6df88
Build: Fix AMD dependencies in curCSS
A leftover `rboxStyle` was left in the wrapper parameters but not in the
dependency array, causing `getStyles` to be undefined in AMD mode.

Since `rboxStyle` is no longer used, it's now removed.

Ref gh-4347
Closes gh-4380
2019-04-30 21:21:18 +02:00
Michał Gołębiowski-Owczarek
cf84696fd1
Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJS
Also, update support comments format to match format described in:
https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197
with the change from:
https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-448998379
(open-ended ranges end with `+`).

Fixes gh-3950
Fixes gh-4299
Closes gh-4347
2019-04-29 22:56:09 +02:00
Richard Gibson
bde53edcf4 Tests: Restrict an event test fallback to TestSwarm
Closes gh-4357
2019-04-29 22:12:59 +02:00
Michał Gołębiowski-Owczarek
58f0c00bed
Core: Remove deprecated jQuery APIs
Fixes gh-4056
Closes gh-4364
2019-04-29 22:04:52 +02:00
Michał Gołębiowski-Owczarek
6f2fae7c41 Tests: Fix the new focusin/focusout test in IE
In IE, focus & blur events fire asynchronously, the test now accounts for that.

Ref gh-4362
2019-04-29 21:40:36 +02:00
Michał Gołębiowski-Owczarek
8a74137693
Event: Stop shimming focusin & focusout events
Latest versions of all browsers now implement focusin & focusout natively
and they all converged on a common event order so it doesn't make much sense
for us to normalize it to a different order anymore.

Note that it means we no longer guarantee that focusin fires before focus
and focusout before blur.

Fixes gh-4300
Closes gh-4362
2019-04-29 21:13:36 +02:00
Michał Gołębiowski-Owczarek
8fae21200e
Data: Separate data & css/effects camelCase implementations
The camelCase implementation used by the data module no longer turns `-ms-foo`
into `msFoo` but to `MsFoo` now. This is because `data` is supposed to be
a generic utility not specifically bound to CSS use cases.

Fixes gh-3355
Closes gh-4365
2019-04-29 21:06:53 +02:00
Richard Gibson
eb6c0a7c97 Event: Prevent leverageNative from registering duplicate dummy handlers
(cherry-picked from 6c1e7dbf73)

Closes gh-4353
2019-04-29 20:50:00 +02:00
Richard Gibson
ddfa837664 Event: Fix handling of multiple async focus events
(cherry-picked from 24d71ac704)

Fixes gh-4350
Closes gh-4354
2019-04-29 20:49:30 +02:00
Michał Gołębiowski-Owczarek
b8d4712825
Build: Test on Node.js 12, stop testing on Node.js 6 & 11
Closes gh-4369
2019-04-23 22:44:15 +02:00
Michał Gołębiowski-Owczarek
874030583c
Build: Fix unresolved jQuery reference in finalPropName
Also, prevent further similar breakages by changing our ESLint configuration
to disallow relying on a global jQuery object in AMD modules.

Fixes gh-4358
Closes gh-4361
2019-04-17 19:56:25 +02:00
Timmy Willison
cf9fe0f6a1
Release: update AUTHORS.txt 2019-04-09 17:17:10 -04:00
Michał Gołębiowski-Owczarek
0b2c36adb4
Build: Update Sizzle from 2.3.3 to 2.3.4
Fixes gh-1756
Fixes gh-4170
Fixes gh-4249
Closes gh-4345
2019-04-09 09:50:45 +02:00
Michał Gołębiowski-Owczarek
00a9c2e5f4 CSS: Don't automatically add "px" to properties with a few exceptions
Fixes gh-2795
Closes gh-4055
Ref gh-4009
2019-04-08 19:26:08 +02:00
Michał Gołębiowski-Owczarek
c4f2fa2fb3 Build: Update the master version to 4.0.0-pre 2019-04-08 18:21:36 +02:00
Michał Gołębiowski-Owczarek
2e4b79ab8f
Tests: Fix the core-js polyfill inclusion method
core-js 3 no longer includes a built file in the bundle but core-js-bundle
does.

Closes gh-4342
Ref gh-4341
2019-04-04 23:45:57 +02:00
Michał Gołębiowski-Owczarek
fea7a2a328
Build: Update Sinon from 2.3.7 to 7.3.1, other updates
Closes gh-4341
2019-04-04 16:53:38 +02:00
Timmy Willison
9b9fca45f3
Update README.md 2019-04-02 12:31:43 -04:00
Michał Gołębiowski-Owczarek
a2a73db99c
Tests: Make Android Browser 4.0-4.3 dimensions tests green
Android Browser disregards td's box-sizing, treating it like it was content-box.
Unlike in IE, offsetHeight shares the same issue so there's no easy way to
workaround the issue without incurring high size penalty. Let's at least check
we get the size as the browser sees it.

Also, fix the nearby support comment syntax.

Closes gh-4335
2019-03-27 15:47:33 +01:00
Michał Gołębiowski-Owczarek
4455f8db4e
Tests: Make Android Browser 4.0-4.3 AJAX tests green
Android Browser versions provided by BrowserStack fail the "prototype collision
(constructor)" test while locally fired emulators don't, even when they connect
to TestSwarm. Just skip the test there to avoid a red build.

Closes gh-4334
2019-03-27 15:46:20 +01:00
buddh4
005040379d Core: Preserve CSP nonce on scripts with src attribute in DOM manipulation
Fixes gh-4323
Closes gh-4328
2019-03-25 18:14:24 +01:00
Richard Gibson
fe5f04de8f Event: Prevent leverageNative from double-firing focusin
Also, reduce size.

Closes gh-4329
Ref gh-4279
2019-03-25 18:12:08 +01:00
Michał Gołębiowski-Owczarek
753d591aea
Core: Prevent Object.prototype pollution for $.extend( true, ... )
Closes gh-4333
2019-03-25 17:57:30 +01:00
Richard Gibson
669f720edc Event: Leverage native events for focus/blur/click; propagate additional data
Summary of the changes/fixes:
1. Trigger checkbox and radio click events identically (cherry-picked from
   b442abacbb that was reverted before).
2. Manually trigger a native event before checkbox/radio handlers.
3. Add test coverage for triggering namespaced native-backed events.
4. Propagate extra parameters passed when triggering the click event to
   the handlers.
5. Intercept and preserve namespaced native-backed events.
6. Leverage native events for focus and blur.
7. Accept that focusin handlers may fire more than once for now.

Fixes gh-1741
Fixes gh-3423
Fixes gh-3751
Fixes gh-4139
Closes gh-4279
Ref gh-1367
Ref gh-3494
2019-03-20 16:40:16 +01:00
Michał Gołębiowski-Owczarek
a0abd15b9e
CSS: Avoid forcing a reflow in width/height getters unless necessary
Fixes gh-4322
Closes gh-4325
Ref gh-3991
Ref gh-4010
Ref gh-4185
Ref gh-4187
2019-03-18 18:44:43 +01:00
Michał Gołębiowski-Owczarek
0ec25abba2
Build: Run the basic test suite in jsdom
The basic test suite is now run in jsdom on all supported Node.js versions
(8, 10 & 11 as of now).

Closes gh-4310
2019-03-11 20:03:54 +01:00