]> source.dussan.org Git - jquery.git/log
jquery.git
4 years agoManipulation: Make jQuery.htmlPrefilter an identity function
Michał Gołębiowski-Owczarek [Mon, 16 Mar 2020 20:49:29 +0000 (21:49 +0100)]
Manipulation: Make jQuery.htmlPrefilter an identity function

Closes gh-4642

4 years agoBuild: Resolve Travis config warnings
Michał Gołębiowski-Owczarek [Fri, 13 Mar 2020 16:16:07 +0000 (17:16 +0100)]
Build: Resolve Travis config warnings

Travis reports warnings in our config:
* root: deprecated key sudo (The key `sudo` has no effect anymore.)
* root: missing os, using the default linux
* root: key matrix is an alias for jobs, using jobs

They are all now resolved.

Closes gh-4636

4 years agoData:Event:Manipulation: Prevent collisions with Object.prototype
Michał Gołębiowski-Owczarek [Mon, 2 Mar 2020 22:02:42 +0000 (23:02 +0100)]
Data:Event:Manipulation: Prevent collisions with Object.prototype

Make sure events & data keys matching Object.prototype properties work.
A separate fix for such events on cloned elements was added as well.

Fixes gh-3256
Closes gh-4603

4 years agoRelease: Use an in-repository dist README fixture
Michał Gołębiowski-Owczarek [Mon, 2 Mar 2020 21:42:38 +0000 (22:42 +0100)]
Release: Use an in-repository dist README fixture

Use a dist README fixture kept in the jQuery repository instead of modifying
an existing one. This makes the jQuery repository the single source of truth
when it comes to jQuery releases and it makes it easier to make changes to
README without worrying how it will affect older jQuery lines.

The commit also ES6ifies build/release.js & build/release/dist.js

Closes gh-4614

4 years agoBuild: Enable ESLint one-var rule for var declarations in browser code
Michał Gołębiowski-Owczarek [Mon, 2 Mar 2020 21:25:35 +0000 (22:25 +0100)]
Build: Enable ESLint one-var rule for var declarations in browser code

Node.js code is written more & more commonly in ES6+ so it doesn't make sense
to enable it there. There are many violations in test code so it's disabled
there as well.

Closes gh-4615

4 years agoTests: Pass a number of necessary done() calls to assert.async()
Michał Gołębiowski-Owczarek [Mon, 2 Mar 2020 21:15:06 +0000 (22:15 +0100)]
Tests: Pass a number of necessary done() calls to assert.async()

It is no longer needed to create `done` wrappers in tests that require
multiple async operations to complete.

Closes gh-4633

4 years agoBuild: Add Christian Oliff to .mailmap & AUTHORS.txt
Michał Gołębiowski-Owczarek [Mon, 24 Feb 2020 18:10:32 +0000 (19:10 +0100)]
Build: Add Christian Oliff to .mailmap & AUTHORS.txt

Closes gh-4613

4 years agoCore: Fire iframe script in its context, add doc param in globalEval
Michał Gołębiowski-Owczarek [Mon, 10 Feb 2020 18:17:22 +0000 (19:17 +0100)]
Core: Fire iframe script in its context, add doc param in globalEval

1. Support passing custom document to jQuery.globalEval; the script will be
   invoked in the context of this document.
2. Fire external scripts appended to iframe contents in that iframe context;
   this was already supported & tested for inline scripts but not for external
   ones.

Fixes gh-4518
Closes gh-4601

4 years agoEvent: remove jQuery.event.global
Michał Gołębiowski-Owczarek [Mon, 10 Feb 2020 18:13:09 +0000 (19:13 +0100)]
Event: remove jQuery.event.global

jQuery.event.global has been write-only in the jQuery source for the past few
years; reading from it was removed in c2d6847de09a52496f78baebc04f317e11ece6d2
when fixing the trac-12989 bug.

Closes gh-4602

4 years agoDocs: Remove a mention of the event/alias.js module from README
Michał Gołębiowski-Owczarek [Mon, 27 Jan 2020 18:22:05 +0000 (19:22 +0100)]
Docs: Remove a mention of the event/alias.js module from README

The file contents now lie in deprecated/event.js so the README reference
is no longer correct.

Ref gh-4572
Closes gh-4599

4 years agoBuild: Lint the minified jQuery file as well - a Gruntfile fix
Michał Gołębiowski-Owczarek [Mon, 27 Jan 2020 18:21:23 +0000 (19:21 +0100)]
Build: Lint the minified jQuery file as well - a Gruntfile fix

While we have absolutely no style-related expectations to our minified file,
we do care that it's valid ES 5.1. This is now verified.

Fixes gh-3075
Ref gh-4594
Closes gh-4598

4 years agoAjax: Deprecate AJAX event aliases, inline event/alias into deprecated
Michał Gołębiowski-Owczarek [Tue, 21 Jan 2020 13:12:35 +0000 (14:12 +0100)]
Ajax: Deprecate AJAX event aliases, inline event/alias into deprecated

A new `src/deprecated` directory makes it possible to exclude some deprecated
APIs from a custom build when their respective "parent" module is excluded
without keeping that module outside of the `src/deprecated` directory or
the `src/deprecated.js` file.

Closes gh-4572

4 years agoCSS: Remove the opacity CSS hook
Michał Gołębiowski-Owczarek [Tue, 21 Jan 2020 13:11:06 +0000 (14:11 +0100)]
CSS: Remove the opacity CSS hook

The consequence is `.css( "opacity" )` will now return an empty string for
detached elements in standard-compliant browsers and "1" in IE & the legacy
Edge. That behavior is shared by most other CSS properties which we're not
normalizing either.

Closes gh-4593

4 years agoBuild: Lint the minified jQuery file as well
Michał Gołębiowski-Owczarek [Tue, 21 Jan 2020 12:51:03 +0000 (13:51 +0100)]
Build: Lint the minified jQuery file as well

While we have absolutely no style-related expectations to our minified file,
we do care that it's valid ES 5.1. This is now verified.

Fixes gh-3075
Closes gh-4594

4 years agoBuild: Add intuitive names to Travis jobs
Michał Gołębiowski-Owczarek [Mon, 20 Jan 2020 18:19:08 +0000 (19:19 +0100)]
Build: Add intuitive names to Travis jobs

Otherwise it's hard to see at a glance that a particular job is running
on Firefox ESR, for example.

Closes gh-4596

4 years agoCore: Exclude callbacks & deferred modules in the slim build as well
Michał Gołębiowski-Owczarek [Mon, 20 Jan 2020 17:58:23 +0000 (18:58 +0100)]
Core: Exclude callbacks & deferred modules in the slim build as well

So far, the slim build only excluded ajax & effects modules. As many web apps
right now rely on native Promises, often with a polyfill for legacy browsers,
deferred & callbacks modules are not that useful for sites that already exclude
ajax & effects modules.

This decreases the gzipped minified size of the slim module by 1760 bytes,
to 19706 bytes (below 20k!).

Closes gh-4553

4 years agoAttributes: Refactor val(): don't strip carriage return, isolate IE workarounds
Michał Gołębiowski-Owczarek [Mon, 13 Jan 2020 18:25:01 +0000 (19:25 +0100)]
Attributes: Refactor val(): don't strip carriage return, isolate IE workarounds

Before this change, `val()` was stripping out carriage return characters from
the returned value. No test has relied on that. The logic was different for
option elements as its custom defined hook was omitting this stripping logic.

This commit gets rid of the carriage return removal and isolates the IE-only
select val getter to be skipped in other browsers.

Closes gh-4585

4 years agoTests: Remove obsolete jQuery data tests
Michał Gołębiowski-Owczarek [Mon, 13 Jan 2020 18:23:01 +0000 (19:23 +0100)]
Tests: Remove obsolete jQuery data tests

The tests relied on `jQuery.cache` so they only ever worked in jQuery 1.x.

Closes gh-4586

4 years agoAttributes: Don't set the type attr hook at all outside of IE
Michał Gołębiowski-Owczarek [Mon, 13 Jan 2020 18:22:08 +0000 (19:22 +0100)]
Attributes: Don't set the type attr hook at all outside of IE

This removes a needless function call in modern browsers.

Closes gh-4587

4 years agoBuild: Make dev mode work in Karma again, serve source files from disk
Michał Gołębiowski-Owczarek [Tue, 7 Jan 2020 23:35:55 +0000 (00:35 +0100)]
Build: Make dev mode work in Karma again, serve source files from disk

PR gh-4550 added support for running ES modules & AMD tests via Karma. This
required reading the `esmodules` & `amd` props from both `QUnit.config` &
`QUnit.urlParams`. By picking these two properties manually, the `dev` one
stopped being respected while ones handled directly by QUnit were fine (like
`hidepassed`). Instead of maintaining the full list of options, the code now
iterates over QUnit URL config and handles the fallbacks in a more generic way.

Apart from that, all jQuery source & test files are now read directly from disk
instead of being cached by Karma so that one can run `grunt karma:chrome-debug`
& work on a fix without restarting that Karma run after each change. A similar
effect could have been achieved by setting `autoWatch` to `true` but then the
main Karma page runs tests in an iframe by default when
`grunt karma:chrome-debug` is run instead of relying on the current debug flow.

Closes gh-4574
Ref gh-4550

4 years agoBuild:Tests: Fix custom build tests, verify on Travis
Michał Gołębiowski-Owczarek [Tue, 7 Jan 2020 22:59:08 +0000 (23:59 +0100)]
Build:Tests: Fix custom build tests, verify on Travis

This commit fixes unit tests for the following builds:

1. The no-deprecated build: `custom:-deprecated`
2. The current slim build: `custom:-ajax,-effects`
3. The future (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects`

It also adds separate Travis jobs for the no-deprecated & slim builds.

Closes gh-4577

4 years agoDocs: Update links to EdgeHTML issues to go through Web Archive
Michał Gołębiowski-Owczarek [Tue, 7 Jan 2020 22:45:41 +0000 (23:45 +0100)]
Docs: Update links to EdgeHTML issues to go through Web Archive

With Microsoft going Chromium with Edge, its old EdgeHTML issues were all
removed. :(

Closes gh-4584

4 years agoBuild: Create a `grunt custom:slim` alias for the Slim build (#4578)
Michał Gołębiowski-Owczarek [Tue, 7 Jan 2020 15:42:49 +0000 (16:42 +0100)]
Build: Create a `grunt custom:slim` alias for the Slim build (#4578)

Closes gh-4578

4 years agoSelector: Remove the "a:enabled" workaround for Chrome <=77
Michał Gołębiowski-Owczarek [Mon, 16 Dec 2019 18:43:38 +0000 (19:43 +0100)]
Selector: Remove the "a:enabled" workaround for Chrome <=77

Remove the workaround for a broken `:enabled` pseudo-class on anchor elements
in Chrome <=77. These versions of Chrome considers anchor elements with the
`href` attribute as matching `:enabled`.

Closes gh-4569

4 years agoDocs: direct users to GitHub docs for cloning the repo
Timmy Willison [Mon, 16 Dec 2019 18:37:16 +0000 (13:37 -0500)]
Docs: direct users to GitHub docs for cloning the repo

Ref gh-4556
Close gh-4571

4 years agoBuild: Make Karma work in ES modules mode
Michał Gołębiowski-Owczarek [Mon, 16 Dec 2019 18:33:49 +0000 (19:33 +0100)]
Build: Make Karma work in ES modules mode

Also, run such a suite in CI to make sure modules are working as expected
when used directly.

Closes gh-4550

4 years agoBuild: Auto-convert sources to AMD
Michał Gołębiowski-Owczarek [Mon, 9 Dec 2019 19:00:44 +0000 (20:00 +0100)]
Build: Auto-convert sources to AMD

jQuery source has been migrated in gh-4541 from AMD to ES modules. To maintain
support for consumers of our AMD modules, this commits adds a task transpiling
the ES modules sources in `src/` to AMD in `amd/`.

A "Load with AMD" checkbox was also restored to the QUnit setup. Note that,
contrary to jQuery 3.x, AMD files need to be generated via `grunt amd` or
`grunt` as sources are not authored in ECMAScript modules. To achieve a similar
no-compile experience during jQuery 4.x testing, use the new "Load as modules"
checkbox which works in all supported browsers except for IE & Edge (the
legacy, EdgeHTML-based one).

Ref gh-4541
Closes gh-4554

4 years agoEvent: Only attach events to objects that accept data - for real
Michał Gołębiowski-Owczarek [Mon, 9 Dec 2019 18:50:14 +0000 (19:50 +0100)]
Event: Only attach events to objects that accept data - for real

There was a check in jQuery.event.add that was supposed to make it a noop
for objects that don't accept data like text or comment nodes. The problem was
the check was incorrect: it assumed `dataPriv.get( elem )` returns a falsy
value for an `elem` that doesn't accept data but that's not the case - we get
an empty object then. The check was changed to use `acceptData` directly.

Fixes gh-4397
Closes gh-4558

4 years agoDocs: Change OS X to macOS in README
Christian Oliff [Tue, 3 Dec 2019 11:35:48 +0000 (20:35 +0900)]
Docs: Change OS X to macOS in README

macOS has been around for long enough to update the naming here.

Closes gh-4552

4 years agoBuild: Fix the Windows build
Michał Gołębiowski-Owczarek [Mon, 2 Dec 2019 18:55:19 +0000 (19:55 +0100)]
Build: Fix the Windows build

This commit gets rid of rollup-plugin-hypothetical in favor of a simpler
inline Rollup plugin that fits our need and is compatible with Windows.

Fixes gh-4548
Closes gh-4549

4 years agoBuild: Require extensions for ES6 imports, prevent import cycles
Michał Gołębiowski-Owczarek [Mon, 25 Nov 2019 19:16:53 +0000 (20:16 +0100)]
Build: Require extensions for ES6 imports, prevent import cycles

jQuery source is now authored in ECMAScript modules. Native browser support
for them requires full file names including extensions. Rollup works even
if import paths don't specify extensions, though, so one import slipped
through without such an extension, breaking native browser import of
src/jquery.js.

A new ESLint rule using eslint-plugin-import prevents us from regressing
on that front.

Also, eslint-plugin-import's no-cycle rule is used to avoid import cycles.

Closes gh-4544
Ref gh-4541
Ref 075320149ae30a5c593c06b2fb015bdf033e0acf

4 years agoBuild: Fix the import path to serialize.js from ajax.js
Michał Gołębiowski-Owczarek [Tue, 19 Nov 2019 14:18:27 +0000 (15:18 +0100)]
Build: Fix the import path to serialize.js from ajax.js

4 years agoSelector: Make empty attribute selectors work in IE again
Michał Gołębiowski-Owczarek [Mon, 18 Nov 2019 21:10:55 +0000 (22:10 +0100)]
Selector: Make empty attribute selectors work in IE again

qSA in IE 11/Edge often (but not always) don't find elements with an empty
name attribute selector (`[name=""]`). Detect that & fall back to Sizzle
traversal.

Interestingly, IE 10 & older don't seem to have the issue.

Fixes gh-4435
Closes gh-4510

4 years agoCore: Migrate from AMD to ES modules 🎉
Michał Gołębiowski-Owczarek [Mon, 18 Nov 2019 20:15:03 +0000 (21:15 +0100)]
Core: Migrate from AMD to ES modules 🎉

Migrate all source AMD modules to ECMAScript modules. The final bundle
is compiled by a custom build process that uses Rollup under the hood.

Test files themselves are still loaded via RequireJS as that has to work in
IE 11.

Tests can now be run in "Load as modules" mode which replaces the previous
"Load with AMD" option. That option of running tests doesn't work in IE
and Edge as it requires support for dynamic imports.

Some of the changes required by the migration:
* check `typeof` of `noGlobal` instead of using the variable directly
  as it's not available when modules are used
* change the nonce module to be an object as ECMASscript module exports
  are immutable
* remove some unused exports
* import `./core/parseHTML.js` directly in `jquery.js` so that it's not
  being cut out when the `ajax` module is excluded in a custom compilation

Closes gh-4541

4 years agoTests: Skip a "width/height on a table row with phantom borders" test in Firefox
Michał Gołębiowski-Owczarek [Mon, 28 Oct 2019 19:38:33 +0000 (20:38 +0100)]
Tests: Skip a "width/height on a table row with phantom borders" test in Firefox

Firefox 70 & newer fail this test but the issue there is more profound - Firefox
doesn't subtract borders from table row computed widths.

Closes gh-4537
Ref jquery/jquery#4529
Ref https://bugzilla.mozilla.org/show_bug.cgi?id=1590837
Ref w3c/csswg-drafts#4444

(cherry picked from commit c79e1d5fefc50b1df0a1c2ca3f06b567e79c0f9b)

4 years agoTests: Don't test synchronous XHR on unload in Chrome
Michał Gołębiowski-Owczarek [Mon, 28 Oct 2019 19:27:49 +0000 (20:27 +0100)]
Tests: Don't test synchronous XHR on unload in Chrome

Chrome 78 dropped support for synchronous XHR requests inside of
beforeunload, unload, pagehide, and visibilitychange event handlers.
See https://bugs.chromium.org/p/chromium/issues/detail?id=952452

Closes gh-4536

(cherry picked from commit c5b48c8caa58e7b73164ac033bf726a072903708)

4 years agoBuild: Run tests on Travis only on browsers defined in the config
Michał Gołębiowski-Owczarek [Tue, 22 Oct 2019 18:49:37 +0000 (20:49 +0200)]
Build: Run tests on Travis only on browsers defined in the config

The environmental variable BROWSERS was being created but it wasn't read in the
list of browsers to pass to Karma.

Closes gh-4532

4 years agoBuild: Run tests on Firefox ESR as well
Michał Gołębiowski-Owczarek [Tue, 22 Oct 2019 18:20:53 +0000 (20:20 +0200)]
Build: Run tests on Firefox ESR as well

Closes gh-4530

(cherry picked from commit 0a73b94a21d4c30b5598b95923dc73d640e07b99)

4 years agoBuild: Run tests on Node.js 13 in addition to 8, 10 & 12
Michał Gołębiowski-Owczarek [Tue, 22 Oct 2019 18:03:36 +0000 (20:03 +0200)]
Build: Run tests on Node.js 13 in addition to 8, 10 & 12

Closes gh-4528

4 years agoBuild: Run tests on Travis on FirefoxHeadless as well
Michał Gołębiowski-Owczarek [Mon, 21 Oct 2019 17:06:39 +0000 (19:06 +0200)]
Build: Run tests on Travis on FirefoxHeadless as well

Also, run them on both ChromeHeadless & FirefoxHeadless locally on
`grunt karma:main`.

Plus, so far, the chrome addons were installed for all the jobs, even
the ones that weren't used for browser testing. Changing that makes
those jobs faster.

Closes gh-4524

4 years agoSelector: Use shallow document comparisons in uniqueSort
Michał Gołębiowski-Owczarek [Mon, 21 Oct 2019 17:04:48 +0000 (19:04 +0200)]
Selector: Use shallow document comparisons in uniqueSort

IE/Edge sometimes crash when comparing documents between frames using the strict
equality operator (`===` & `!==`). Funnily enough, shallow comparisons
(`==` & `!=`) work without crashing.

The change to shallow comparisons in `src/selector.js` was done in gh-4471 but
relevant changes in `src/selector/uniqueSort.js` were missed. Those changes
have landed in Sizzle in jquery/sizzle#459.

Fixes gh-4441
Closes gh-4512
Ref gh-4471
Ref jquery/sizzle#459

4 years agoDocs: Update most URLs to HTTPS
Michał Gołębiowski-Owczarek [Mon, 21 Oct 2019 17:03:48 +0000 (19:03 +0200)]
Docs: Update most URLs to HTTPS

Closes gh-4511

4 years agoSelector: Add a test for throwing on post-comma invalid selectors
Michał Gołębiowski-Owczarek [Mon, 21 Oct 2019 17:03:03 +0000 (19:03 +0200)]
Selector: Add a test for throwing on post-comma invalid selectors

Sizzle's PR jquery/sizzle#456 introduced a test catching not throwing on
badly-escaped identifiers by Firefox 3.6-5. Unfortunately, it was placed just
before a test Opera 10-11 failed, making Opera fail quicker and not adding
a post-comma invalid selector to rbuggyQSA.

The issue was fixed in jquery/sizzle#463. This jQuery commit backports the test
that Sizzle PR added as no workarounds are needed in browsers jQuery supports.

Closes gh-4516
Ref jquery/sizzle#456
Ref jquery/sizzle#463

4 years agoTests: Stop using jQuery.find in tests
Michał Gołębiowski-Owczarek [Mon, 21 Oct 2019 17:02:22 +0000 (19:02 +0200)]
Tests: Stop using jQuery.find in tests

This prepares us for possibly hiding jQuery.find in jQuery 4.0.

Closes gh-4517

5 years agoCSS: Workaround buggy getComputedStyle on table rows in IE/Edge
Michał Gołębiowski-Owczarek [Mon, 14 Oct 2019 16:41:35 +0000 (18:41 +0200)]
CSS: Workaround buggy getComputedStyle on table rows in IE/Edge

Fixes gh-4490
Closes gh-4506

5 years agoSelector: Make selectors with leading combinators use qSA again
Michał Gołębiowski-Owczarek [Mon, 14 Oct 2019 16:28:19 +0000 (18:28 +0200)]
Selector: Make selectors with leading combinators use qSA again

An optimization added in jquery/sizzle#431 skips the temporary IDs for selectors
not using child or descendant combinators. For sibling combinators, though, this
pushes a selector with a leading combinator to qSA directly which crashes and
falls back to a slower Sizzle route.

This commit makes selectors with leading combinators not skip the selector
rewriting. Note that after jquery/jquery#4454 & jquery/sizzle#453, all modern
browsers other than Edge leverage the :scope pseudo-class, avoiding temporary
id attributes.

Closes gh-4509
Ref jquery/sizzle#431

5 years agoBuild: Require strict mode in Node.js scripts via ESLint
Michał Gołębiowski-Owczarek [Tue, 8 Oct 2019 22:17:55 +0000 (00:17 +0200)]
Build: Require strict mode in Node.js scripts via ESLint

So far, only browser-based JS files were required to be in strict mode (in the
function form). This commit adds such a requirement to Node.js scripts where
the global form is preferred. All Node.js scripts in sloppy mode were
converted to strict mode.

Closes gh-4499

5 years agoManipulation:Selector: Use the nodeName util where possible to save size
Michał Gołębiowski-Owczarek [Tue, 8 Oct 2019 20:41:59 +0000 (22:41 +0200)]
Manipulation:Selector: Use the nodeName util where possible to save size

Saves 20 bytes.

Closes gh-4504

5 years agoDocs: Convert link to Homebrew from HTTP to HTTPS
Christian Oliff [Mon, 7 Oct 2019 06:45:40 +0000 (15:45 +0900)]
Docs: Convert link to Homebrew from HTTP to HTTPS

`http://brew.sh/` -> `https://brew.sh/`

Closes gh-4501

5 years agoBuild: Support jquery-release --dry-run flag
Michał Gołębiowski-Owczarek [Sat, 5 Oct 2019 16:48:27 +0000 (18:48 +0200)]
Build: Support jquery-release --dry-run flag

Without this change passing `--dry-run` to jquery-release still pushes to the
jquery-dist repository which is dangerous as one can assume `--dry-run` to be
safe from external side effects.

Close gh-4498

5 years agoBuild: Stop copying src/core.js to dist on release
Michał Gołębiowski-Owczarek [Fri, 4 Oct 2019 14:13:14 +0000 (16:13 +0200)]
Build: Stop copying src/core.js to dist on release

File `src/core.js` has started erroneously being copied to `dist/` in gh-2981.

Fixes gh-4489
Closes gh-4492
Ref gh-2979
Ref gh-2981

5 years agoRelease: Update AUTHORS.txt
Michał Gołębiowski-Owczarek [Thu, 26 Sep 2019 19:12:38 +0000 (21:12 +0200)]
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.

5 years agoAjax: Do not execute scripts for unsuccessful HTTP responses
Sean Robinson [Fri, 26 Apr 2019 14:25:08 +0000 (07:25 -0700)]
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

5 years agoCore: Use Array.prototype.flat where supported
Ahmed.S.ElAfifi [Mon, 19 Aug 2019 08:04:01 +0000 (10:04 +0200)]
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

5 years agoSelector: Use shallow document comparisons to avoid IE/Edge crashes
Michał Gołębiowski-Owczarek [Tue, 24 Sep 2019 22:41:07 +0000 (00:41 +0200)]
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

5 years agoCore: Remove private copies of push, sort & splice from the jQuery prototype
Michał Gołębiowski-Owczarek [Tue, 24 Sep 2019 00:12:36 +0000 (02:12 +0200)]
Core: Remove private copies of push, sort & splice from the jQuery prototype

Closes gh-4473

5 years agoCore: Implement .even() & .odd() to replace POS :even & :odd
Michał Gołębiowski-Owczarek [Tue, 24 Sep 2019 00:04:53 +0000 (02:04 +0200)]
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

5 years agoDeprecated: Fix AMD parameter order
Michał Gołębiowski-Owczarek [Fri, 30 Aug 2019 23:40:45 +0000 (01:40 +0200)]
Deprecated: Fix AMD parameter order

Ref gh-4461

5 years agoSelector: reduce size, simplify setDocument
Michał Gołębiowski-Owczarek [Mon, 26 Aug 2019 17:15:53 +0000 (19:15 +0200)]
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

5 years agoAjax: Simplify jQuery.ajaxSettings.xhr
Michał Gołębiowski-Owczarek [Mon, 26 Aug 2019 17:01:26 +0000 (19:01 +0200)]
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

5 years agoBuild: Remove the external directory, read from node_modules directly
Michał Gołębiowski-Owczarek [Mon, 26 Aug 2019 16:53:54 +0000 (18:53 +0200)]
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

5 years agoCore: Deprecate jQuery.trim
Shashanka Nataraj [Thu, 22 Aug 2019 00:06:26 +0000 (05:36 +0530)]
Core: Deprecate jQuery.trim

Fixes gh-4363
Closes gh-4461

5 years agoTests: Port changes from Sizzle
Richard Gibson [Tue, 20 Aug 2019 18:05:37 +0000 (14:05 -0400)]
Tests: Port changes from Sizzle

Ref https://github.com/jquery/sizzle/pull/450
Closes gh-4464

5 years agoSelector: Leverage the :scope pseudo-class where possible
Michał Gołębiowski-Owczarek [Mon, 19 Aug 2019 16:41:03 +0000 (18:41 +0200)]
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

5 years agoTests: Fix a comment in testinit.js
Michał Gołębiowski-Owczarek [Mon, 19 Aug 2019 16:36:21 +0000 (18:36 +0200)]
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

5 years agoTests: update npo.js and include unminified source instead
Timmy Willison [Mon, 12 Aug 2019 16:06:52 +0000 (12:06 -0400)]
Tests: update npo.js and include unminified source instead

Close gh-4446
Ref gh-4445

5 years agoSelector: Bring back querySelectorAll shortcut usage
Michał Gołębiowski-Owczarek [Fri, 9 Aug 2019 10:42:05 +0000 (12:42 +0200)]
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

5 years agoSelector: Inline Sizzle into the selector module
Michał Gołębiowski-Owczarek [Mon, 29 Jul 2019 19:14:46 +0000 (21:14 +0200)]
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

5 years agoSelector: Port Sizzle tests to jQuery
Michał Gołębiowski-Owczarek [Wed, 26 Jun 2019 19:39:10 +0000 (21:39 +0200)]
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

5 years agoBuild: ESLint: forbid unused function parameters
Michał Gołębiowski-Owczarek [Mon, 13 May 2019 20:25:11 +0000 (22:25 +0200)]
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

5 years agoBuild: Fix the regex parsing AMD var-modules (#4389)
Michał Gołębiowski-Owczarek [Mon, 13 May 2019 19:55:45 +0000 (21:55 +0200)]
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

5 years agoCore: Remove IE-specific support tests, rely on document.documentMode
Michał Gołębiowski-Owczarek [Mon, 13 May 2019 19:39:56 +0000 (21:39 +0200)]
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

5 years agoTraversing: Fix `contents()` on `<object>`s with children in IE
Michał Gołębiowski-Owczarek [Wed, 8 May 2019 08:12:36 +0000 (10:12 +0200)]
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

5 years agoTraversing: Fix `contents()` on `<object>`s with children
Pat O'Callaghan [Mon, 6 May 2019 17:23:00 +0000 (18:23 +0100)]
Traversing: Fix `contents()` on `<object>`s with children

Fixes gh-4384
Closes gh-4385

5 years agoEffect: Fix a unnecessary conditional statement in .stop()
Wonseop Kim [Wed, 1 May 2019 12:57:55 +0000 (21:57 +0900)]
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

5 years agoBuild: Fix AMD dependencies in curCSS
Michał Gołębiowski-Owczarek [Tue, 30 Apr 2019 19:21:18 +0000 (21:21 +0200)]
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

5 years agoCore: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJS
Michał Gołębiowski-Owczarek [Mon, 29 Apr 2019 20:56:09 +0000 (22:56 +0200)]
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

5 years agoTests: Restrict an event test fallback to TestSwarm
Richard Gibson [Tue, 16 Apr 2019 04:47:02 +0000 (00:47 -0400)]
Tests: Restrict an event test fallback to TestSwarm

Closes gh-4357

5 years agoCore: Remove deprecated jQuery APIs
Michał Gołębiowski-Owczarek [Mon, 29 Apr 2019 20:04:52 +0000 (22:04 +0200)]
Core: Remove deprecated jQuery APIs

Fixes gh-4056
Closes gh-4364

5 years agoTests: Fix the new focusin/focusout test in IE
Michał Gołębiowski-Owczarek [Mon, 29 Apr 2019 19:40:36 +0000 (21:40 +0200)]
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

5 years agoEvent: Stop shimming focusin & focusout events
Michał Gołębiowski-Owczarek [Mon, 29 Apr 2019 19:13:36 +0000 (21:13 +0200)]
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

5 years agoData: Separate data & css/effects camelCase implementations
Michał Gołębiowski-Owczarek [Mon, 29 Apr 2019 19:06:53 +0000 (21:06 +0200)]
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

5 years agoEvent: Prevent leverageNative from registering duplicate dummy handlers
Richard Gibson [Mon, 29 Apr 2019 17:26:53 +0000 (13:26 -0400)]
Event: Prevent leverageNative from registering duplicate dummy handlers

(cherry-picked from 6c1e7dbf7311ae7c0c31ba335fe216185047ae5f)

Closes gh-4353

5 years agoEvent: Fix handling of multiple async focus events
Richard Gibson [Mon, 29 Apr 2019 17:18:08 +0000 (13:18 -0400)]
Event: Fix handling of multiple async focus events

(cherry-picked from 24d71ac70406f522fc1b09bf7c4025251ec3aee6)

Fixes gh-4350
Closes gh-4354

5 years agoBuild: Test on Node.js 12, stop testing on Node.js 6 & 11
Michał Gołębiowski-Owczarek [Tue, 23 Apr 2019 20:44:15 +0000 (22:44 +0200)]
Build: Test on Node.js 12, stop testing on Node.js 6 & 11

Closes gh-4369

5 years agoBuild: Fix unresolved jQuery reference in finalPropName
Michał Gołębiowski-Owczarek [Wed, 17 Apr 2019 17:56:25 +0000 (19:56 +0200)]
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

5 years agoRelease: update AUTHORS.txt
Timmy Willison [Tue, 9 Apr 2019 21:17:10 +0000 (17:17 -0400)]
Release: update AUTHORS.txt

5 years agoBuild: Update Sizzle from 2.3.3 to 2.3.4
Michał Gołębiowski-Owczarek [Tue, 9 Apr 2019 07:50:45 +0000 (09:50 +0200)]
Build: Update Sizzle from 2.3.3 to 2.3.4

Fixes gh-1756
Fixes gh-4170
Fixes gh-4249
Closes gh-4345

5 years agoCSS: Don't automatically add "px" to properties with a few exceptions 4055/head
Michał Gołębiowski-Owczarek [Mon, 23 Apr 2018 19:00:14 +0000 (21:00 +0200)]
CSS: Don't automatically add "px" to properties with a few exceptions

Fixes gh-2795
Closes gh-4055
Ref gh-4009

5 years agoBuild: Update the master version to 4.0.0-pre
Michał Gołębiowski-Owczarek [Mon, 8 Apr 2019 16:21:36 +0000 (18:21 +0200)]
Build: Update the master version to 4.0.0-pre

5 years agoTests: Fix the core-js polyfill inclusion method
Michał Gołębiowski-Owczarek [Thu, 4 Apr 2019 21:45:57 +0000 (23:45 +0200)]
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

5 years agoBuild: Update Sinon from 2.3.7 to 7.3.1, other updates
Michał Gołębiowski-Owczarek [Thu, 4 Apr 2019 14:53:38 +0000 (16:53 +0200)]
Build: Update Sinon from 2.3.7 to 7.3.1, other updates

Closes gh-4341

5 years agoUpdate README.md
Timmy Willison [Tue, 2 Apr 2019 16:31:43 +0000 (12:31 -0400)]
Update README.md

5 years agoTests: Make Android Browser 4.0-4.3 dimensions tests green
Michał Gołębiowski-Owczarek [Wed, 27 Mar 2019 14:47:33 +0000 (15:47 +0100)]
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

5 years agoTests: Make Android Browser 4.0-4.3 AJAX tests green
Michał Gołębiowski-Owczarek [Wed, 27 Mar 2019 14:46:20 +0000 (15:46 +0100)]
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

5 years agoCore: Preserve CSP nonce on scripts with src attribute in DOM manipulation 4328/head
buddh4 [Tue, 19 Mar 2019 21:40:30 +0000 (22:40 +0100)]
Core: Preserve CSP nonce on scripts with src attribute in DOM manipulation

Fixes gh-4323
Closes gh-4328

5 years agoEvent: Prevent leverageNative from double-firing focusin
Richard Gibson [Mon, 25 Mar 2019 17:12:08 +0000 (13:12 -0400)]
Event: Prevent leverageNative from double-firing focusin

Also, reduce size.

Closes gh-4329
Ref gh-4279

5 years agoCore: Prevent Object.prototype pollution for $.extend( true, ... )
Michał Gołębiowski-Owczarek [Mon, 25 Mar 2019 16:57:30 +0000 (17:57 +0100)]
Core: Prevent Object.prototype pollution for $.extend( true, ... )

Closes gh-4333

5 years agoEvent: Leverage native events for focus/blur/click; propagate additional data
Richard Gibson [Wed, 11 Jan 2017 22:19:30 +0000 (15:19 -0700)]
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
   b442abacbb8464f0165059e8da734e3143d0721f 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

5 years agoCSS: Avoid forcing a reflow in width/height getters unless necessary
Michał Gołębiowski-Owczarek [Mon, 18 Mar 2019 17:44:43 +0000 (18:44 +0100)]
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