aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Event: Only attach events to objects that accept data - for realMichał Gołębiowski-Owczarek2019-12-091-2/+3
| | | | | | | | | | 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
* Build: Require extensions for ES6 imports, prevent import cyclesMichał Gołębiowski-Owczarek2019-11-251-0/+7
| | | | | | | | | | | | | | | | 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
* Build: Fix the import path to serialize.js from ajax.jsMichał Gołębiowski-Owczarek2019-11-191-1/+1
|
* Selector: Make empty attribute selectors work in IE againMichał Gołębiowski-Owczarek2019-11-183-4/+18
| | | | | | | | | | 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
* Core: Migrate from AMD to ES modules 🎉Michał Gołębiowski-Owczarek2019-11-18112-1088/+563
| | | | | | | | | | | | | | | | | | | | | | 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
* Selector: Use shallow document comparisons in uniqueSortMichał Gołębiowski-Owczarek2019-10-211-3/+16
| | | | | | | | | | | | | | 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
* Docs: Update most URLs to HTTPSMichał Gołębiowski-Owczarek2019-10-211-7/+7
| | | Closes gh-4511
* CSS: Workaround buggy getComputedStyle on table rows in IE/EdgeMichał Gołębiowski-Owczarek2019-10-142-9/+58
| | | | Fixes gh-4490 Closes gh-4506
* Selector: Make selectors with leading combinators use qSA againMichał Gołębiowski-Owczarek2019-10-141-1/+4
| | | | | | | | | | | | | | 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
* Manipulation:Selector: Use the nodeName util where possible to save sizeMichał Gołębiowski-Owczarek2019-10-082-19/+18
| | | | | Saves 20 bytes. Closes gh-4504
* Ajax: Do not execute scripts for unsuccessful HTTP responsesSean Robinson2019-09-261-0/+5
| | | | | | | | | 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
* Core: Use Array.prototype.flat where supportedAhmed.S.ElAfifi2019-09-254-13/+21
| | | | | | | | | | | 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
* Selector: Use shallow document comparisons to avoid IE/Edge crashesMichał Gołębiowski-Owczarek2019-09-251-13/+24
| | | | | | | | | 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
* Core: Remove private copies of push, sort & splice from the jQuery prototypeMichał Gołębiowski-Owczarek2019-09-244-13/+15
| | | Closes gh-4473
* Core: Implement .even() & .odd() to replace POS :even & :oddMichał Gołębiowski-Owczarek2019-09-241-0/+12
| | | | | | `: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
* Deprecated: Fix AMD parameter orderMichał Gołębiowski-Owczarek2019-08-311-1/+1
| | | | Ref gh-4461
* Selector: reduce size, simplify setDocumentMichał Gołębiowski-Owczarek2019-08-262-128/+112
| | | | | | | | | | | 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
* Ajax: Simplify jQuery.ajaxSettings.xhrMichał Gołębiowski-Owczarek2019-08-261-3/+1
| | | | | | | | | | | | | | | 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
* Core: Deprecate jQuery.trimShashanka Nataraj2019-08-222-7/+7
| | | | | Fixes gh-4363 Closes gh-4461
* Selector: Leverage the :scope pseudo-class where possibleMichał Gołębiowski-Owczarek2019-08-192-11/+35
| | | | | | | | | | | | | | | | | | | 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
* Selector: Bring back querySelectorAll shortcut usageMichał Gołębiowski-Owczarek2019-08-091-2/+1
| | | | | | | 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
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-2916-310/+1898
| | | | | | | | | | | | | | | | | | 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
* Selector: Port Sizzle tests to jQueryMichał Gołębiowski-Owczarek2019-06-261-5/+9
| | | | | | | 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
* Build: ESLint: forbid unused function parametersMichał Gołębiowski-Owczarek2019-05-1316-34/+23
| | | | | | | | | | | | | 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
* Core: Remove IE-specific support tests, rely on document.documentModeMichał Gołębiowski-Owczarek2019-05-139-144/+41
| | | | | | | Also, update some tests to IE-sniff when deciding whether to skip a test. Fixes gh-4386 Closes gh-4387
* Traversing: Fix `contents()` on `<object>`s with children in IEMichał Gołębiowski-Owczarek2019-05-081-2/+9
| | | | | | | | | 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
* Traversing: Fix `contents()` on `<object>`s with childrenPat O'Callaghan2019-05-061-1/+1
| | | | Fixes gh-4384 Closes gh-4385
* Effect: Fix a unnecessary conditional statement in .stop()Wonseop Kim2019-05-011-1/+1
| | | | | | | | | 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
* Build: Fix AMD dependencies in curCSSMichał Gołębiowski-Owczarek2019-04-302-8/+1
| | | | | | | | | 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
* Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-2951-657/+275
| | | | | | | | | | | 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
* Core: Remove deprecated jQuery APIsMichał Gołębiowski-Owczarek2019-04-293-33/+4
| | | | Fixes gh-4056 Closes gh-4364
* Event: Stop shimming focusin & focusout eventsMichał Gołębiowski-Owczarek2019-04-293-67/+0
| | | | | | | | | | | 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
* Data: Separate data & css/effects camelCase implementationsMichał Gołębiowski-Owczarek2019-04-295-17/+34
| | | | | | | | 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
* Event: Prevent leverageNative from registering duplicate dummy handlersRichard Gibson2019-04-291-5/+5
| | | | | | (cherry-picked from 6c1e7dbf7311ae7c0c31ba335fe216185047ae5f) Closes gh-4353
* Event: Fix handling of multiple async focus eventsRichard Gibson2019-04-291-12/+18
| | | | | | | (cherry-picked from 24d71ac70406f522fc1b09bf7c4025251ec3aee6) Fixes gh-4350 Closes gh-4354
* Build: Fix unresolved jQuery reference in finalPropNameMichał Gołębiowski-Owczarek2019-04-172-4/+12
| | | | | | | 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
* CSS: Don't automatically add "px" to properties with a few exceptionsMichał Gołębiowski-Owczarek2019-04-084-35/+53
| | | | | | Fixes gh-2795 Closes gh-4055 Ref gh-4009
* Core: Preserve CSP nonce on scripts with src attribute in DOM manipulationbuddh42019-03-252-3/+5
| | | | | Fixes gh-4323 Closes gh-4328
* Event: Prevent leverageNative from double-firing focusinRichard Gibson2019-03-251-88/+84
| | | | | | Also, reduce size. Closes gh-4329 Ref gh-4279
* Core: Prevent Object.prototype pollution for $.extend( true, ... )Michał Gołębiowski-Owczarek2019-03-251-1/+2
| | | Closes gh-4333
* Event: Leverage native events for focus/blur/click; propagate additional dataRichard Gibson2019-03-204-24/+161
| | | | | | | | | | | | | | | | | | | | | 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
* CSS: Avoid forcing a reflow in width/height getters unless necessaryMichał Gołębiowski-Owczarek2019-03-181-3/+12
| | | | | | | | Fixes gh-4322 Closes gh-4325 Ref gh-3991 Ref gh-4010 Ref gh-4185 Ref gh-4187
* Build: Remove obsolete globals from ESLint configurationMichał Gołębiowski-Owczarek2019-02-191-1/+5
| | | | | We had quite a few obsolete globals declared in various ESLint config files. We also no longer allow to rely on the `noGlobal` & `jQuery` globals in the built file which is not needed. Closes gh-4301
* Core: Support passing nonce through jQuery.globalEvalMichał Gołębiowski-Owczarek2019-01-213-15/+18
| | | | | | Fixes gh-4278 Closes gh-4280 Ref gh-3541 Ref gh-4269
* Manipulation: Respect script nomodule attribute in DOM manipulationMichał Gołębiowski-Owczarek2019-01-211-1/+1
| | | | | | | | | | | | | 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
* Core: Preserve CSP nonce on scripts in DOM manipulationMichał Gołębiowski-Owczarek2019-01-141-0/+10
| | | | Fixes gh-3541 Closes gh-4269
* Manipulation: Restore _evalUrl jQuery.ajax calls to dataType: scriptRichard Gibson2018-12-131-4/+8
| | | | | | IE and iOS <10 XHR transport does not succeed on data: URIs Ref gh-4243 Ref gh-4126 Closes gh-4258
* Manipulation: Only evaluate HTTP-successful script srcRichard Gibson2018-12-121-2/+7
| | | | | Fixes gh-4126 Closes gh-4243
* Core: Tiny efficiency fix to jQuery.extend / jQuery.fn.extend (#4246)Marja Hölttä2018-12-121-6/+8
| | | | | | | | | Read target[name] only when it's needed. In addition to doing the property read-only when needed, this avoids a slow path in V8 (see the issue for more details). Fixes gh-4245 Closes gh-4246
* Dimensions: fall back to offsetWidth/Height for border-box in IETimmy Willison2018-11-271-15/+18
| | | | | | | | - Use getClientRects() to explicitly detect hidden/disconnected elements Close gh-4223 Fixes gh-4102