Commit Graph

6467 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
364476c3dc
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
2020-03-02 22:15:06 +01:00
Michał Gołębiowski-Owczarek
721744a9fa
Build: Add Christian Oliff to .mailmap & AUTHORS.txt
Closes gh-4613
2020-02-24 19:10:32 +01:00
Michał Gołębiowski-Owczarek
4592595b47
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
2020-02-10 19:17:22 +01:00
Michał Gołębiowski-Owczarek
18db87172c
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 c2d6847de0
when fixing the trac-12989 bug.

Closes gh-4602
2020-02-10 19:13:09 +01:00
Michał Gołębiowski-Owczarek
3edfa1bcdc
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
2020-01-27 19:22:05 +01:00
Michał Gołębiowski-Owczarek
338f1fc774
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
2020-01-27 19:21:23 +01:00
Michał Gołębiowski-Owczarek
23d53928f3
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
2020-01-21 14:12:35 +01:00
Michał Gołębiowski-Owczarek
865469f5e6
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
2020-01-21 14:11:06 +01:00
Michał Gołębiowski-Owczarek
89a18de64c
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
2020-01-21 13:51:03 +01:00
Michał Gołębiowski-Owczarek
e1fab10911
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
2020-01-20 19:19:08 +01:00
Michał Gołębiowski-Owczarek
fbc44f52fe
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
2020-01-20 18:58:23 +01:00
Michał Gołębiowski-Owczarek
ff2819911d
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
2020-01-13 19:25:01 +01:00
Michał Gołębiowski-Owczarek
eb35be528f
Tests: Remove obsolete jQuery data tests
The tests relied on `jQuery.cache` so they only ever worked in jQuery 1.x.

Closes gh-4586
2020-01-13 19:23:01 +01:00
Michał Gołębiowski-Owczarek
9e66fe9acf
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
2020-01-13 19:22:08 +01:00
Michał Gołębiowski-Owczarek
437f389a24
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
2020-01-08 00:35:55 +01:00
Michał Gołębiowski-Owczarek
0f780ba7cc
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
2020-01-07 23:59:08 +01:00
Michał Gołębiowski-Owczarek
1dad1185e0
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
2020-01-07 23:45:41 +01:00
Michał Gołębiowski-Owczarek
9b9ed469b4
Build: Create a grunt custom:slim alias for the Slim build (#4578)
Closes gh-4578
2020-01-07 16:42:49 +01:00
Michał Gołębiowski-Owczarek
c1ee33aded
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
2019-12-16 19:43:38 +01:00
Timmy Willison
f1c16de296
Docs: direct users to GitHub docs for cloning the repo
Ref gh-4556
Close gh-4571
2019-12-16 13:37:16 -05:00
Michał Gołębiowski-Owczarek
341c6d1b5a
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
2019-12-16 19:33:49 +01:00
Michał Gołębiowski-Owczarek
f37c2e51f3
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
2019-12-09 20:00:44 +01:00
Michał Gołębiowski-Owczarek
d5c505e35d
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
2019-12-09 19:50:14 +01:00
Christian Oliff
5a3e0664d2 Docs: Change OS X to macOS in README
macOS has been around for long enough to update the naming here.

Closes gh-4552
2019-12-03 12:35:48 +01:00
Michał Gołębiowski-Owczarek
9fd2fa5388
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
2019-12-02 19:55:19 +01:00
Michał Gołębiowski-Owczarek
44ac8c8529
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 075320149a
2019-11-25 20:16:53 +01:00
Michał Gołębiowski-Owczarek
075320149a Build: Fix the import path to serialize.js from ajax.js 2019-11-19 15:18:27 +01:00
Michał Gołębiowski-Owczarek
05184cc448
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
2019-11-18 22:10:55 +01:00
Michał Gołębiowski-Owczarek
d0ce00cdfa
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
2019-11-18 21:15:03 +01:00
Michał Gołębiowski-Owczarek
a612733be0 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 c79e1d5fef)
2019-10-28 20:43:39 +01:00
Michał Gołębiowski-Owczarek
323575fb9b 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 c5b48c8caa)
2019-10-28 20:43:16 +01:00
Michał Gołębiowski-Owczarek
bcbcdd2b2c
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
2019-10-22 20:49:37 +02:00
Michał Gołębiowski-Owczarek
2d5ad6d23e Build: Run tests on Firefox ESR as well
Closes gh-4530

(cherry picked from commit 0a73b94a21)
2019-10-22 20:22:53 +02:00
Michał Gołębiowski-Owczarek
830976e690
Build: Run tests on Node.js 13 in addition to 8, 10 & 12
Closes gh-4528
2019-10-22 20:03:36 +02:00
Michał Gołębiowski-Owczarek
584835e682
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
2019-10-21 19:06:39 +02:00
Michał Gołębiowski-Owczarek
15750b0af2
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
2019-10-21 19:04:48 +02:00
Michał Gołębiowski-Owczarek
f09d92100f
Docs: Update most URLs to HTTPS
Closes gh-4511
2019-10-21 19:03:48 +02:00
Michał Gołębiowski-Owczarek
6eee5f7f18
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
2019-10-21 19:03:03 +02:00
Michał Gołębiowski-Owczarek
1d624c10b4
Tests: Stop using jQuery.find in tests
This prepares us for possibly hiding jQuery.find in jQuery 4.0.

Closes gh-4517
2019-10-21 19:02:22 +02:00
Michał Gołębiowski-Owczarek
26415e081b
CSS: Workaround buggy getComputedStyle on table rows in IE/Edge
Fixes gh-4490
Closes gh-4506
2019-10-14 18:41:35 +02:00
Michał Gołębiowski-Owczarek
ed66d5a22b
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
2019-10-14 18:28:19 +02:00
Michał Gołębiowski-Owczarek
bbad821c39
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
2019-10-09 00:17:55 +02:00
Michał Gołębiowski-Owczarek
4504fc3d72
Manipulation:Selector: Use the nodeName util where possible to save size
Saves 20 bytes.

Closes gh-4504
2019-10-08 22:41:59 +02:00
Christian Oliff
e0022f2314 Docs: Convert link to Homebrew from HTTP to HTTPS
`http://brew.sh/` -> `https://brew.sh/`

Closes gh-4501
2019-10-07 08:45:40 +02:00
Michał Gołębiowski-Owczarek
d7d0b52bda
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
2019-10-05 18:48:27 +02:00
Michał Gołębiowski-Owczarek
9a4d980639
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
2019-10-04 16:13:14 +02:00
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