Commit Graph

2290 Commits

Author SHA1 Message Date
Ahmed.S.ElAfifi
2f666c1dab 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.

(cherry picked from 9df4f1de12)

Fixes gh-4320
Closes gh-4459
2019-09-25 17:49:32 +02:00
Michał Gołębiowski-Owczarek
409cbda7fe 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

(cherry picked from commit 78420d427c)
2019-09-24 02:05:39 +02:00
Michał Gołębiowski-Owczarek
0c67da4b74
Tests: Fix offset fractions tests in Chrome for Android
This commit backports a looser assertion from `master` where the browsers passes
offset tests.

Closes gh-4470
2019-09-24 00:58:53 +02:00
Michał Gołębiowski-Owczarek
6276cb2e23 Tests: Move Android user agent detection above iOS, put Safari last
Android was catching the generic iOS regex. Checking for Android first should
eliminate that issue as iOS user agents don't contain the word "Android".
Putting Safari last makes Android UAs not be tested against it.
2019-09-24 00:46:21 +02:00
Michał Gołębiowski-Owczarek
8167327fd9
Tests: Make support tests accept Safari 13 & newer
The regexes detecting browsers with their versions have been updated for iOS
and Safari so that all iOS >=11 & all Safari (desktop) >= 11 are recognized.
This is required to make Safari 13 & iOS 13 pass support tests but it'll also
make tests forward-compatible with future Safari/iOS versions.

Closes gh-4488
2019-09-23 19:28:43 +02:00
Michał Gołębiowski-Owczarek
2d9d6d5b47
Selector: Make selector-native's isXMLDoc recognize HTML-embedded SVG
This commit also backports some jQuery.isXMLDoc tests from master so that this
behavior doesn't regress.

(partially cherry-picked from 79b74e043a)

Closes gh-4438
Ref jquery/sizzle#378
Ref jquery/sizzle#436
2019-07-29 22:06:18 +02:00
Pat O'Callaghan
42badf3460 Traversing: Fix contents() on <object>s with children
(cherry-picked from 4d865d96aa)

Fixes gh-4384
Closes gh-4385
2019-05-06 21:07:53 +02:00
Michał Gołębiowski-Owczarek
7dddb19ca4
Core: Make isAttached work with iOS 10.0-10.2
The test for Shadow DOM v1 support has been changed to rely on the presence of
`documentElement.getRootNode` as iOS 10.0-10.2 supports `attachShadow` but
doesn't support `getRootNode`.

No new test is necessary - iOS 10.0 fails lots of our test suite because of
this bug.

Fixes gh-4356
Closes gh-4360
2019-04-29 19:54:12 +02:00
Richard Gibson
24d71ac704 Event: Fix handling of multiple async focus events
Fixes gh-4350
Closes gh-4354
2019-04-29 19:18:08 +02: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
Michał Gołębiowski-Owczarek
6ced2639b5
Build: Update QUnit from 1.23.1 to 2.9.2
Closes gh-4307
2019-03-04 20:10:21 +01:00
Michał Gołębiowski-Owczarek
9cb124ed00
Build: Update jsdom; migrate a test with Symbol polyfill to an iframe test
So far, we've been testing that jQuery element iteration works with polyfilled
Symbol & transpiled for-of via a Node test with jsdom with the Symbol global
removed. Unfortunately, jsdom now requires Symbol to be present for its internal
functionality so such a test is no longer possible. Instead, it's been migrated
to an iframe test with transpiled JavaScript.

This PR also enables us to use ECMAScript 2017 or newer in Node.js code.

Closes gh-4305
2019-03-04 18:30:51 +01:00
abnud1
c349818742 Build: Update test code for compatibility with QUnit 2.x (#4297)
Also, run `grunt npmcopy` to sync the "external" directory with dependencies
from package.json. For example, the Sinon library version didn't match.

Ref gh-4234
Closes gh-4297
2019-02-18 19:03:26 +01:00
Michał Gołębiowski-Owczarek
5bdc85b82b
Core: Support passing nonce through jQuery.globalEval
Fixes gh-4278
Closes gh-4280
Ref gh-3541
Ref gh-4269
2019-01-21 18:42:39 +01:00
Michał Gołębiowski-Owczarek
e4de8b4626
Manipulation: Respect script nomodule attribute in DOM manipulation
PR #3869 added support for `<script type="module">` & some support for
the `nomodule` attribute but with no tests for `nomodule` and with the
attribute only respected on inline scripts. This commit adds support for
source-based scripts as well. It also adds tests for `nomodule`, including
making sure legacy browsers execute such scripts as they'd natively do - that's
the whole point of `nomodule` scripts, after all.

Fixes gh-4281
Closes gh-4282
Ref gh-3871
Ref gh-3869
2019-01-21 18:34:40 +01:00
Michał Gołębiowski-Owczarek
543d3d24ea Tests: Skip nonce tests in old iOS/Android as well
Old iOS & Android Browser versions support script-src but not nonce, making the
nonce test impossible to run. Browsers not supporting CSP at all are not
a problem as they'll skip script-src restrictions completely.

Ref gh-3541
Ref gh-4269
Ref c7c2855ed1
2019-01-14 19:49:28 +01:00
Michał Gołębiowski-Owczarek
c7c2855ed1
Core: Preserve CSP nonce on scripts in DOM manipulation
Fixes gh-3541
Closes gh-4269
2019-01-14 19:29:54 +01:00
Michał Gołębiowski-Owczarek
9cb162f6b6
Tests: Exclude Android 4.x from repeated header names test
Android Browser only returns the last value for each header so there's no way
for jQuery get all parts.

Closes gh-4259
Ref gh-3403
Ref gh-4173
2018-12-14 22:06:44 +01:00
Richard Gibson
c2026b117d Manipulation: Only evaluate HTTP-successful script src
Fixes gh-4126
Closes gh-4243
2018-12-12 17:21:24 +01:00
Timmy Willison
13f3cd1611
Tests: fix dimensions tests in testswarm
Close gh-4248
2018-12-03 12:03:04 -05:00
Timmy Willison
315199c156
Dimensions: fall back to offsetWidth/Height for border-box in IE
- Use getClientRects() to explicitly detect hidden/disconnected
  elements

Close gh-4223
Fixes gh-4102
2018-11-27 14:28:59 -05:00
Andrei Fangli
e0d9411569 Ajax: Fix getResponseHeader(key) for IE11
- getResponseHeader(key) combines all header values for the provided key into a
single result where values are concatenated by ', '. This does not happen for
IE11 since multiple values for the same header are returned on separate lines.
This makes the function only return the last value of the header for IE11.
- Updated ajax headers test to better cover Object.prototype collisions

Close gh-4173
Fixes gh-3403
2018-11-26 12:00:41 -05:00
Michał Gołębiowski-Owczarek
3ac907864c Tests: Add Safari 12 & iOS 12 results 2018-11-12 18:55:47 +01:00
Michał Gołębiowski-Owczarek
bc8aedf042 Tests: Move latest Firefox before Firefox 60 test results 2018-11-12 18:54:15 +01:00
Saptak Sengupta
9b77def560 Core: Recognize Shadow DOM in attachment checks
Allow `isAttached` to check Shadow DOM for attachment.

Fixes gh-3504
Closes gh-3996
Ref gh-3977
2018-11-09 12:15:31 +01:00
Michał Gołębiowski-Owczarek
354f6036f2
CSS: Don't read styles.position in the width/height cssHook unless necessary
Current width/height cssHook reads the computed position style even if not
necessary as the browser passes the scrollboxSize support test. That has been
changed.

This commit also makes the scrollboxSize support test in line with all others
(i.e. only return true or false) and changes the variable name in the hook
to make the code clearer.

Fixes gh-4185
Closes gh-4187
2018-10-08 18:25:15 +02:00
Michał Gołębiowski-Owczarek
dae5f3ce3d
Tests: Add tests for not auto-appending "px" to CSS Grid properties
Ref gh-4007
Ref gh-4028
Closes gh-4165
2018-10-03 12:00:52 +02:00
Richard Gibson
dfa92ccead
Tests: Allow Karma to load unminfied source
Closes gh-4128
2018-09-07 10:14:01 -04:00
Jason Bedard
6153eb0fd4
Tests: use width style instead of SVG width attribute (#4157)
The SVG width attribute seems to not support border-box in iOS7.

Closes gh-4155
2018-08-20 21:13:33 -07:00
Michał Gołębiowski-Owczarek
c9aae3565e Tests: Account for the iPad with iOS 11.3 user agent
The user agent of the iPad with iOS 11.3 on BrowserStack is missing the "iPhone"
part in the "iPhone OS 11_3" part. This commit makes the iOS regex accept such
(probably?) malformed UAs.
2018-08-01 15:12:30 +02:00
Michał Gołębiowski-Owczarek
ae82e85e64
Tests: Skip module tests in Edge
Edge sometimes doesn't execute module scripts. It needs to be investigated why
but for now, we're skipping the test to make our tests more stable.

Closes gh-4140
2018-07-30 18:41:08 +02:00
Michał Gołębiowski-Owczarek
063c1f2ca3 Tests: Make support tests pass in Firefox 52
jQuery Core now supports Firefox ESR.
2018-07-30 18:06:08 +02:00
Richard Gibson
979809c5a8
Manipulation: Properly detect HTML elements with single-character names
Fixes gh-4124
Closes gh-4125
2018-07-13 00:35:08 -04:00
Michał Gołębiowski-Owczarek
cc95204589
Tests: Add support test results for Firefox 61+
Firefox 61 now passes the reliableMarginLeft test.

Closes gh-4122
2018-07-09 18:37:52 +02:00
Jason Bedard
e743cbd285
Dimensions: fix computing outerWidth on SVGs
Fixes gh-3964
Closes gh-4096
2018-06-20 22:09:29 -07:00
Timmy Willison
0645099e02
Serialize: jQuery.param: return empty string when given null/undefined
Fixes gh-2633
Close gh-4108
2018-06-20 12:07:44 -04:00
Michał Gołębiowski-Owczarek
81d829b357
Test: enable a spec testing CSS whitespace preserving in Edge 17
In Edge 14-16 setting a style property to a whitespace-only value resets it to
the default, forcing us to skip a relevant CSS test in Edge. Now that Edge 17
has fixed the issue we can re-enable this test there.

Ref gh-3204
Closes gh-4101
2018-06-18 18:48:15 +02:00
Michał Gołębiowski-Owczarek
75b77b4873
CSS: Don't auto-append "px" to CSS variables (#4064)
Fixes gh-4063
Closes gh-4064
2018-06-04 18:08:06 +02:00
Dave Methvin
dc48b11e0c squash! Set attributes all at once, src last 2018-05-14 14:09:43 -04:00
Dave Methvin
1f4375a342 Ajax: Allow custom attributes when script transport is used
Fixes gh-3028
Ref gh-2612

Useful, for example, to add `nonce`, `integrity`, or `crossorigin`.
2018-05-14 14:09:43 -04:00
Luis Emilio Velasco Sanchez
0ba8e38d0c Traversing: $.fn.contents() support for object
Fixes gh-4045
Closes gh-4046
2018-05-14 13:41:42 -04:00
Richard Gibson
821bf34353
CSS: Correctly detect scrollbox support with non-default zoom
Fixes gh-4029
Closes gh-4030
2018-05-07 09:28:18 -04:00
Michał Gołębiowski-Owczarek
f8c1e9020c
CSS: Ensure camel- vs kebab-cased names are not collapsed for CSS vars
Closes gh-4062
2018-05-02 17:08:20 +02:00
Michał Gołębiowski-Owczarek
f5e36bd8f2
CSS: Skip the px-appending logic for animations of non-element props
Without this change animating properties from jQuery.cssNumber on non-elements
throws an error.

Ref gh-4055
Closes gh-4061
2018-04-30 18:52:39 +02:00
Michał Gołębiowski-Owczarek
9a5b3b6ed0 Tests: ensure support tests are failed by at least one tested browser
A whitelist is available so that some tests can be allowed to always succeed.
This is used only for ajax for now as it can be manually disabled in IE but
is enabled by default.

Closes gh-4052
2018-04-23 20:39:52 +02:00
Michał Gołębiowski-Owczarek
4a2bcc27f9
Tests: Fix Android 4.0 Deferred tests
Closes gh-3967
2018-02-12 20:24:58 +01:00
Michał Gołębiowski-Owczarek
56742491bd
Tests: Disable native abort test in Android 4.0
The test works on its own when checked manually but mysteriously fails in
TestSwarm only in Android 4.0. Let's just disable it there.

Closes gh-3968
2018-02-12 19:08:36 +01:00
Timmy Willison
6483af7ee5
Tests: skip test with invalid selector for selector-native tests 2018-01-19 11:13:48 -05:00
Timmy Willison
625e19cd9b
Tests: ensure that module assertions run on supported browsers
- Also fixes tests for karma, where the URL for the module is different

Ref gh-3871
2018-01-16 15:18:32 -05:00
basil.belokon
5d3a968e03
Manipulation: Add support for scripts with module type
Fixes gh-3871
Close gh-3869
2018-01-16 11:39:16 -05:00
Timmy Willison
14e5143b83
Tests: fix number of expected assertions in basic core 2018-01-16 10:51:03 -05:00
Jason Bedard
1ea092a54b
Core: deprecate jQuery.type
Fixes gh-3605
Close gh-3895
2018-01-16 10:39:08 -05:00
Timmy Willison
91fb18190e
Tests: fix weird flaky attributes test in Edge 16
Fixes gh-3867
Close gh-3931
2018-01-16 10:18:27 -05:00
Timmy Willison
5e6deb3999
Tests: fix weird failure in Edge 16 CSS
Fixes gh-3866
Close gh-3932
2018-01-16 10:16:15 -05:00
Jason Bedard
c4494d4abc Core: deprecate jQuery.isNumeric
Fixes gh-2960
Closes gh-3888
2018-01-15 20:50:02 -08:00
Dave Methvin
d7237896c7 Ajax: Don't process non-string data property on no-entity-body requests
Fixes gh-3438
Closes gh-3781
2018-01-15 21:48:54 -05:00
Dave Methvin
022b69a44e Event: Move event aliases to deprecated
Fixes gh-3214
2018-01-15 21:40:45 -05:00
Jason Bedard
3d732cca6b Core: deprecate jQuery.isFunction
Fixes gh-3609
2018-01-15 09:26:19 -08:00
Timmy Willison
50b94f47d2
Tests: fix function reference for unbinding
Ref gh-2958
2018-01-08 11:55:14 -05:00
Timmy Willison
e2f192887c
Tests: only run ontimeout test if ontimeout exists
Fixes gh-3742
Close gh-3919
2018-01-08 11:46:43 -05:00
Timmy Willison
7be448d41f
Ajax: add unit test for getScript(Object)
Fixes gh-3736
Close gh-3918
2018-01-08 11:45:21 -05:00
Timmy Willison
80f57f8a13
Attributes: allow array param in add/remove/toggleClass
+30 bytes instead of +182

Thanks to @faisaliyk for the first pass on this feature.

Fixes gh-3532
Close gh-3917
2018-01-08 11:43:53 -05:00
Timmy Willison
3a8e44745c
Core: deprecate jQuery.proxy (not slated for removal)
Fixes gh-2958
Close gh-3885
2018-01-08 11:28:35 -05:00
Timmy Willison
909e0c9925
Core: deprecate jQuery.now
Fixes gh-2959
Close gh-3884
2018-01-08 11:24:45 -05:00
Timmy Willison
775caebd61
Core: adjust data tests to ensure proper camelCasing
- Add back camelCase to the public object (deprecate not remove)
Ref #3384
2018-01-08 11:21:22 -05:00
Nilton Cesar
64a289286a
Core: make camelCase function available only for internal usage
Close gh-3604
Fixes gh-3384
2018-01-08 11:21:22 -05:00
Timo Tijhof
ecd8ddea33
Tests: Add support for running unit tests via grunt with karma
- Update QUnit to 1.23.1
- Remove unused dl#dl from test/index.html
- Remove unused map#imgmap from test/index.html
- Ensure all urls to data use baseURI
- Add the 'grunt karma:main' task
  - customContextFile & customDebugFile
- Add 'npm run jenkins' script

Close gh-3744
Fixes gh-1999
2017-12-18 12:27:38 -05:00
Saptak Sengupta
f00a07590e CSS: Correctly set support properties with non-default zoom
Fixes gh-3808
Closes gh-3872
2017-12-05 23:59:54 -05:00
Michał Gołębiowski-Owczarek
60cc6c9fbf Tests: Add iOS 11 support test results 2017-11-20 23:46:31 +01:00
Michał Gołębiowski-Owczarek
50e3395e7e Tests: Add Safari 11 support test results 2017-10-18 17:59:22 +02:00
Richard Gibson
94ddf62022 CSS: Detect more WebKit styles erroneously reported as percentages
Ref 692f9d4db3
Fixes gh-3777
Closes gh-3778
2017-09-18 11:59:50 -04:00
Richard Gibson
8ea78caa82 Tests: Update lineHeight adjustments to give Android more slop 2017-09-08 17:14:57 -04:00
Richard Gibson
692f9d4db3 CSS: Avoid unit-conversion interference from CSS upper bounds
Fixes gh-2144
Closes gh-3745
2017-08-28 13:23:04 -04:00
Richard Gibson
3cf1d14ccc Dimensions: Don't trust non-pixel computed width/height
Fixes gh-3611
Closes gh-3741
2017-08-07 12:26:03 -04:00
Richard Gibson
f3c5776b82 Tests: Replace non-ASCII whitespace in source code 2017-07-31 15:16:23 -04:00
Richard Gibson
a49578499e Dimensions: Improve offsetWidth/offsetHeight fallback
Fixes gh-3698
Fixes gh-3602
Closes gh-3738
2017-07-31 12:36:54 -04:00
Erik Lax
262acc6f1e
Ajax: add an ontimeout handler to all requests
Fixes gh-3586
Close gh-3590
2017-07-24 11:44:09 -04:00
Richard Gibson
d65bdd5fc8 Tests: Account for TestSwarm focus issues
Closes gh-3732
2017-07-20 14:17:09 -04:00
Richard Gibson
deba37e53d Tests: Simulate events when CI hinders use of native ones
Ref gh-3732
2017-07-20 13:16:04 -04:00
Richard Gibson
928c580a1a Tests: Reduce the abort timeout for simple focus testing
Ref gh-3732
2017-07-19 11:45:03 -04:00
Richard Gibson
03db56a7e3 Tests: Abort focus tests when the environment doesn't cooperate
Ref gh-3732
2017-07-18 20:49:47 -04:00
Richard Gibson
d9a099a58e Tests: Try extra hard to control focus
Ref gh-3732
2017-07-18 20:32:01 -04:00
Richard Gibson
20cdf4e7de Support: Properly check for IE9 absolute scrollbox mishandling
Ref gh-3589
Fixes gh-3699
Fixes gh-3730
Closes gh-3729
2017-07-18 15:40:41 -04:00
Richard Gibson
3fcddd6e72 Dimensions: Detect and account for content-box dimension mishandling
Fixes gh-3699
Closes gh-3700
2017-07-10 12:35:03 -04:00
Jason Bedard
30b5ba5b92 Test: ensure position/offset return mutable objects
Fixes gh-3612
Closes gh-3695
2017-07-10 09:03:08 -07:00
Shashanka Nataraj
c18d608537
Core: Deprecate jQuery.isWindow
Fixes gh-3629
Close gh-3702
2017-07-10 12:00:27 -04:00
Pierre Spring
490db839fb
Event: stopPropagation() on native event-handler
Fixes gh-3693
Close gh-3694
2017-07-10 11:55:32 -04:00
Richard Gibson
80f1c8239e Dimensions: Include scroll gutter in "padding" box
Fixes gh-3589
Closes gh-3656
2017-06-19 15:42:55 -04:00
Andreas Solleder
5bdd1ca1ab
Tests: minor typos
Close gh-3671
2017-06-05 11:46:43 -04:00
Michał Gołębiowski
731c501155 Docs:Tests: Update IE/Edge-related support comments & tests
Closes gh-3661
2017-05-15 20:37:14 +02:00
Richard Gibson
00cc67af23 Tests: Correct expected assertion count
Ref e94b5b0bbf
2017-04-29 01:37:47 -04:00
Richard Gibson
e94b5b0bbf Tests: Clean up offset debugging
Ref 1d2df772b4
Ref c0edd8dc18
2017-04-29 01:35:20 -04:00
Richard Gibson
da533c6acc Tests: Adjust by actual scroll position, rather than expected
Ref 1d2df772b4
2017-04-29 01:22:55 -04:00