aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
Commit message (Collapse)AuthorAgeFilesLines
* Core: Use named exports in `src/`Michał Gołębiowski-Owczarek2023-09-121-15/+15
| | | | | | | | | The `default` export is treated differently across tooling when transpiled to CommonJS - tools differ on whether `module.exports` represents the full module object or just its default export. Switch `src/` modules to named exports for tooling consistency. Fixes gh-5262 Closes gh-5292
* Core: Fix regression in jQuery.text() on HTMLDocument objectsTimo Tijhof2023-06-121-2/+7
| | | | | | | Fixes gh-5264 Closes gh-5265 (cherry picked from commit 44c56f87a31fbc1f43ac575cfd06a0df12073352)
* Core:Selector: Move jQuery.contains from the selector to the core moduleMichał Gołębiowski-Owczarek2022-12-121-0/+14
| | | | | | | The `jQuery.contains` method is quite simple in jQuery 4+. On the other side, it's a dependency of the core `isAttached` util which is not ideal; moving it from the `selector` the `core` module resolves the issue. Closes gh-5167
* Core:Manipulation: Add basic TrustedHTML supportMichał Gołębiowski-Owczarek2021-09-301-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures HTML wrapped in TrustedHTML can be used as an input to jQuery manipulation methods in a way that doesn't violate the `require-trusted-types-for` Content Security Policy directive. This commit builds on previous work needed for trusted types support, including gh-4642 and gh-4724. One restriction is that while any TrustedHTML wrapper should work as input for jQuery methods like `.html()` or `.append()`, for passing directly to the `jQuery` factory the string must start with `<` and end with `>`; no trailing or leading whitespaces are allowed. This is necessary as we cannot parse out a part of the input for further construction; that would violate the CSP rule - and that's what's done to HTML input not matching these constraints. No trusted types API is used explicitly in source; the majority of the work is ensuring we don't pass the input converted to string to APIs that would eventually assign it to `innerHTML`. This extra cautiousness is caused by the API being Blink-only, at least for now. The ban on passing strings to `innerHTML` means support tests relying on such assignments are impossible. We don't currently have such tests on the `main` branch but we used to have many of them in the 3.x & older lines. If there's a need to re-add such a test, we'll need an escape hatch to skip them for apps needing CSP-enforced TrustedHTML. See https://web.dev/trusted-types/ for more information about TrustedHTML. Fixes gh-4409 Closes gh-4927 Ref gh-4642 Ref gh-4724
* Core: Make jQuery.isXMLDoc accept falsy inputMichał Gołębiowski-Owczarek2020-12-071-2/+2
| | | | Fixes gh-4782 Closes gh-4814
* Core: Drop support for Edge Legacy (i.e. non-Chromium Microsoft Edge)Michał Gołębiowski-Owczarek2020-09-221-12/+1
| | | | | | | | | | | | Drop support for Edge Legacy: the non-Chromium, EdgeHTML-based Microsoft Edge version. Also, restrict some workarounds that were applied unconditionally in all browsers to run only in IE now. This slightly increases the size but reduces the performance burden on modern browsers that don't need the workarounds. Also, clean up some comments & remove some obsolete workarounds. Fixes gh-4568 Closes gh-4792
* Build: Correct code indentations based on jQuery Style GuideWonseop Kim2020-05-051-4/+4
| | | | | | | | 1. Correct code indentations based on jQuery Style Guide (contribute.jquery.org/style-guide/js/#spacing). 2. Add rules to "src/.eslintrc.json" to enable "enforcing consistent indentation", with minimal changes to the current code. Closes gh-4672
* Build: Move ESLint max-len disable-directive to dist/.eslintrc.jsonEd S2020-04-271-2/+0
| | | | | | | This disable-directive only applies to the built version, so put it in /dist. This avoids a warning about an unused directive in the source version. Closes gh-4676
* Core: Fire iframe script in its context, add doc param in globalEvalMichał Gołębiowski-Owczarek2020-02-101-3/+4
| | | | | | | | | | 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
* Core: Migrate from AMD to ES modules 🎉Michał Gołębiowski-Owczarek2019-11-181-28/+19
| | | | | | | | | | | | | | | | | | | | | | 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
* Core: Use Array.prototype.flat where supportedAhmed.S.ElAfifi2019-09-251-3/+3
| | | | | | | | | | | 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
* Core: Remove private copies of push, sort & splice from the jQuery prototypeMichał Gołębiowski-Owczarek2019-09-241-7/+1
| | | 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
* Core: Deprecate jQuery.trimShashanka Nataraj2019-08-221-5/+1
| | | | | Fixes gh-4363 Closes gh-4461
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-291-2/+50
| | | | | | | | | | | | | | | | | | 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
* Build: ESLint: forbid unused function parametersMichał Gołębiowski-Owczarek2019-05-131-3/+2
| | | | | | | | | | | | | 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: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-291-20/+7
| | | | | | | | | | | 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: Prevent Object.prototype pollution for $.extend( true, ... )Michał Gołębiowski-Owczarek2019-03-251-1/+2
| | | Closes gh-4333
* Core: Support passing nonce through jQuery.globalEvalMichał Gołębiowski-Owczarek2019-01-211-2/+2
| | | | | | Fixes gh-4278 Closes gh-4280 Ref gh-3541 Ref gh-4269
* 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
* Build: Remove unnecessary ESLint exceptionEd S2018-06-181-3/+0
| | | | | The linked-to issue was fixed 2 years ago. Closes gh-4095
* Core: deprecate jQuery.typeJason Bedard2018-01-161-14/+4
| | | | | Fixes gh-3605 Close gh-3895
* Core: deprecate jQuery.isNumericJason Bedard2018-01-151-14/+0
| | | | | Fixes gh-2960 Closes gh-3888
* Core: deprecate jQuery.isFunctionJason Bedard2018-01-151-12/+4
| | | | Fixes gh-3609
* Core: deprecate jQuery.proxy (not slated for removal)Timmy Willison2018-01-081-29/+0
| | | | | Fixes gh-2958 Close gh-3885
* Core: deprecate jQuery.nowTimmy Willison2018-01-081-2/+0
| | | | | Fixes gh-2959 Close gh-3884
* Core: make camelCase function available only for internal usageNilton Cesar2018-01-081-17/+1
| | | | | Close gh-3604 Fixes gh-3384
* Core: Deprecate jQuery.isWindowShashanka Nataraj2017-07-101-6/+3
| | | | | Fixes gh-3629 Close gh-3702
* Docs:Tests: Update IE/Edge-related support comments & testsMichał Gołębiowski2017-05-151-1/+1
| | | Closes gh-3661
* Core: Update isFunction to handle unusual-@@toStringTag inputRichard Gibson2017-04-241-2/+7
| | | | | | Ref gh-3597 Fixes gh-3600 Fixes gh-3596 Closes gh-3617
* Core: Deprecate jQuery.nodeNamekaran-962017-03-011-4/+0
| | | | | Fixes gh-3475 Closes gh-3505
* Core: Deprecate jQuery.isArrayManoj Kumar2016-11-301-4/+2
| | | | | Fixes gh-2961 Closes gh-3278
* Build: .eslintrc -> .eslintrc.jsonOleg Gaidarenko2016-08-021-1/+1
| | | | | | | | `.eslintrc` format is deprecated - http://eslint.org/docs/user-guide/configuring#configuration-file-formats Fixes gh-3248 Closes gh-3247
* Build: Update eslint config and fix associated errorsOleg Gaidarenko2016-07-151-5/+6
|
* Build: ESLint detailsOleg Gaidarenko2016-06-111-6/+8
| | | | | | Use eslint pragmas, fix new errors, etc Closes gh-3148
* Build: Put all AMD modules in "src/" in strict modeMichał Gołębiowski2016-04-251-0/+2
| | | | Fixes gh-3073
* Core: Simplify isPlainObjectRichard Gibson2016-04-041-18/+18
| | | | | Fixes gh-2986 Close gh-2998
* Docs: Update support comments to follow the new syntaxMichał Gołębiowski2016-03-301-5/+5
| | | | | The changes follow the spec proposed in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197
* Docs: Update support comments related to IEMichał Gołębiowski2016-03-301-1/+1
| | | | All support comments were checked for Edge applicability.
* Core: Restore 1.x isPlainObject constructor checksRichard Gibson2016-03-141-1/+3
| | | | | | | - Guard isPlainObject against inherited scalar constructors Fixes gh-2982 Close gh-2985
* Core: restore enumeration behavior in isPlainObjectTimmy Willison2016-03-071-3/+6
| | | | | Fixes gh-2968 Close gh-2970
* Core: Improve isNumeric logic and test coverageSteve Mao2016-01-241-1/+5
| | | | | | | | | Also add back accidentally deleted comments about the implementation. Fixes gh-2780 Ref gh-2663 Ref gh-2781 Closes gh-2827
* Core: do not expose second argument of the `jQuery.globalEval`Oleg Gaidarenko2015-12-021-8/+6
| | | | | Closes jquery/api.jquery.com#831 Closes gh-2718
* Manipulation: execute scripts from iframe in the iframe's contextTimmy Willison2015-11-091-3/+4
| | | | | Fixes gh-1757 Close gh-2696
* Core: make isNumeric limited to strings and numbersTimmy Willison2015-10-211-6/+6
| | | | Fixes gh-2662
* Core: make isNumeric test work on SymbolLiza Ramo2015-10-171-1/+2
| | | | | Ref #2645 Closes #2657
* Core: Support Symbol wrapper objects in jQuery.typeChristian Grete2015-10-131-1/+1
| | | | | | | | | In ECMAScript 2015 (ES6), the native typeof operator returns "symbol" for Symbol primitives. As it is possible to wrap symbols using the Object constructor, symbols can be objects as well as any other primitive type in JavaScript and should be determined by jQuery.type. Closes gh-2627
* Core: Remove unnecessary parameter to jQuery#constructorYongwoo Jeon2015-09-081-1/+1
| | | | Closes gh-2441
* Build: Update jscs and lint filesOleg Gaidarenko2015-09-071-21/+29
| | | | Fixes gh-2056
* Core: .each/.map should accept an undefined/null valueThomas Tortorini2015-07-271-11/+9
| | | | | Fixes gh-2267 Closes gh-2363