aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
Commit message (Collapse)AuthorAgeFilesLines
* Data: Refactor to reduce sizeRichard Gibson2024-01-221-16/+8
| | | | | | * Return the new value from `set(owner, key, value)`. * Use `set(owner, key, value)` rather than `access(owner, key, value)`. Close gh-5392
* Selector: Eliminate `selector.js` depenencies from various modulesMichał Gołębiowski-Owczarek2024-01-041-1/+0
| | | | | | | | | There are two main reasons for why some of those dependencies are no longer needed: 1. `jQuery.contains` which is now a part of `core`. 2. `jQuery.find.attr` no longer exists, native `getAttribute` is used instead. Closes gh-5383 Ref gh-5379
* Core: Simplify code post browser support reductionMichał Gołębiowski-Owczarek2023-09-201-1/+1
| | | | | | | | | | | | | | | | | Summary of the changes: * Core: Simplify code post browser support reduction * Tests: Remove legacy jQuery.cache & oldIE leftovers * Tests: Reformat JavaScript in delegatetest.html * Docs: "jQuery Foundation Projects" -> "jQuery Projects" * Tests: Drop an unused localfile.html file (modern browsers don't support the `file:` protocol this way, there's no point in keeping the file around) * Effects: Remove a redundant `!fn` check (`fn || !fn && easing` is equivalent to `fn || easing`; simplify the code) * CSS: Explain the fallback to direct object access in curCSS better * Tests: Deduplicate `jQuery.parseHTML` test titles * Dimensions: Add a test for fractional values * Tests: Fix a buggy WebKit regex Closes gh-5296
* 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
* Manipulation: Extract domManip to a separate fileMichał Gołębiowski-Owczarek2022-10-101-104/+1
| | | | | | | | | | | We've already had `buildFragment` extracted to a separate file long ago. `domManip` is quite a complex & crucial API and so far it has existed within the `manipulation.js` module. Extracting it makes the module shorter and easier to understand. A few comments / messages in tests have also been updated to not suggest there's a public `jQuery.domManip` API - it's been private since 3.0.0. Closes gh-5138
* Docs: Replace `#NUMBER` Trac issue references with `trac-NUMBER`Michał Gołębiowski-Owczarek2022-01-041-1/+1
| | | | | | | | | | | | | The GitHub UI treats `#NUMBER` as referring to its own issues which is confusing when in jQuery source it's usually referring to the old deprecated Trac instance at https://bugs.jquery.com. This change replaces all such Trac references with `trac-NUMBER`. A few of the references came with the Sizzle integration and referred to the Sizzle GitHub bug tracker. Those have been replaced with full links instead. A new entry describing issue reference conventions has been added to README. Closes gh-4993
* Manipulation: Don't remove HTML comments from scriptsMichał Gołębiowski-Owczarek2021-07-191-4/+2
| | | | | | | | | | | | | | | | | | | When evaluating scripts, jQuery strips out the possible wrapping HTML comment and a CDATA section. However, all supported browsers are already doing that when loading JS via appending a script tag to the DOM which is how we've been doing `jQuery.globalEval` since jQuery 3.0.0. jQuery logic was imperfect, e.g. it just stripped the `<!--` and `-->` markers, respectively at the beginning or the end of the script contents. However, browsers are also stripping everything following those markers in the same line, treating them as single-line comments delimiters; this is now also mandated by ECMAScript 2015 in Annex B. Instead of fixing the jQuery logic, just let the browser do its thing. We also used to strip CDATA sections. However, this shouldn't be needed as in XML documents they're already not visible when inspecting element contents and in HTML documents they have no meaning. We've preserved that behavior for backwards compatibility in 3.x but we're removing it for 4.0. Fixes gh-4904 Closes gh-4906
* Core: Drop support for Edge Legacy (i.e. non-Chromium Microsoft Edge)Michał Gołębiowski-Owczarek2020-09-221-4/+3
| | | | | | | | | | | | 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
* Manipulation: Respect script crossorigin attribute in DOM manipulation高灰2020-09-221-1/+2
| | | | | | Fixes gh-4542 Closes gh-4563 Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
* Manipulation: Make jQuery.htmlPrefilter an identity functionMichał Gołębiowski-Owczarek2020-03-161-4/+1
| | | Closes gh-4642
* Data:Event:Manipulation: Prevent collisions with Object.prototypeMichał Gołębiowski-Owczarek2020-03-021-5/+3
| | | | | | | 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
* Core: Fire iframe script in its context, add doc param in globalEvalMichał Gołębiowski-Owczarek2020-02-101-1/+1
| | | | | | | | | | 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-31/+23
| | | | | | | | | | | | | | | | | | | | | | 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
* Manipulation:Selector: Use the nodeName util where possible to save sizeMichał Gołębiowski-Owczarek2019-10-081-1/+1
| | | | | Saves 20 bytes. Closes gh-4504
* 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
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-291-5/+2
| | | | | | | | | | | | | | | | | | 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-4/+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: Remove IE-specific support tests, rely on document.documentModeMichał Gołębiowski-Owczarek2019-05-131-6/+6
| | | | | | | Also, update some tests to IE-sniff when deciding whether to skip a test. Fixes gh-4386 Closes gh-4387
* Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-291-34/+12
| | | | | | | | | | | 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: Preserve CSP nonce on scripts with src attribute in DOM manipulationbuddh42019-03-251-1/+3
| | | | | Fixes gh-4323 Closes gh-4328
* Event: Leverage native events for focus/blur/click; propagate additional dataRichard Gibson2019-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | | 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
* Core: Support passing nonce through jQuery.globalEvalMichał Gołębiowski-Owczarek2019-01-211-1/+1
| | | | | | 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: Recognize Shadow DOM in attachment checksSaptak Sengupta2018-11-091-1/+1
| | | | | | | Allow `isAttached` to check Shadow DOM for attachment. Fixes gh-3504 Closes gh-3996 Ref gh-3977
* Core: Use isAttached to check for attachment of elementSaptak Sengupta2018-03-051-3/+4
| | | | | | | This change replaces the use of contains to check for attachment by isAttached function Closes gh-3977 Ref gh-3504
* Manipulation: Add support for scripts with module typebasil.belokon2018-01-161-2/+2
| | | | | Fixes gh-3871 Close gh-3869
* Core: deprecate jQuery.isFunctionJason Bedard2018-01-151-4/+5
| | | | Fixes gh-3609
* Manipulation: use `.children` to select tbody elementsTimmy Willison2018-01-081-1/+1
| | | | | - selectors beginning with a child combinator are not valid natively. This fixes the tests when using selector-native.js
* Manipulation: Reduce size by eliminating single-use variableRichard Gibson2017-11-221-5/+2
| | | Closes gh-3851
* Docs:Tests: Update IE/Edge-related support comments & testsMichał Gołębiowski2017-05-151-1/+1
| | | Closes gh-3661
* Revert "Event: Trigger checkbox and radio click events identically"Timmy Willison2017-03-201-3/+3
| | | | This reverts commit b442abacbb8464f0165059e8da734e3143d0721f.
* Build: fix tests in AMD modeTimmy Willison2017-03-061-1/+1
| | | | - nodeName was included at the wrong spot in dependency lists
* Core: Deprecate jQuery.nodeNamekaran-962017-03-011-3/+4
| | | | | Fixes gh-3475 Closes gh-3505
* Event: Trigger checkbox and radio click events identicallyAlex Padilla2017-01-191-3/+3
| | | | | Fixes gh-3423 Closes gh-3494
* Manipulation: Restrict the tbody search to child nodesRichard Gibson2017-01-091-1/+2
| | | | | | | For performance, use a querySelectorAll path instead of Javascript iteration. http://codepen.io/anon/pen/vywJjx?editors=1010 Fixes gh-3439 Closes gh-3463
* Build: ESLint detailsOleg Gaidarenko2016-06-111-0/+6
| | | | | | 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
* Docs: Update support comments to follow the new syntaxMichał Gołębiowski2016-03-301-4/+4
| | | | | 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.
* Docs: Updated links to https where they are supported.Jon Dufresne2016-01-131-1/+1
| | | | Close gh-2746
* Manipulation: Bring tagname regexes up to specLeonardo Braga2016-01-071-1/+1
| | | | | Fixes gh-2005 Closes gh-2634
* Core: do not expose second argument of the `jQuery.globalEval`Oleg Gaidarenko2015-12-021-2/+3
| | | | | Closes jquery/api.jquery.com#831 Closes gh-2718
* Manipulation: execute scripts from iframe in the iframe's contextTimmy Willison2015-11-091-1/+1
| | | | | Fixes gh-1757 Close gh-2696
* Data: avoid using delete on DOM nodesJason Bedard2015-09-081-2/+8
| | | | Closes gh-2479
* Manipulation: Switch rnoInnerhtml to a version more performant in IESean Henderson2015-09-081-1/+5
| | | | | | | | | | | | IE versions greater than 9 do not handle the old regular expression well with large html content. This is due to the use of a non-capturing group after a very common html character (<). Test suite: http://jsfiddle.net/Lwa0t5rp/3/ Microsoft bug: https://connect.microsoft.com/IE/feedback/details/1736512/ Fixes gh-2563 Closes gh-2574
* Data: Don't expose jQuery.acceptDataJason Bedard2015-09-081-3/+3
| | | | | | jQuery.acceptData is an undocumented internal API that shouldn't be exposed. Fixes gh-2555
* Build: Update jscs and lint filesOleg Gaidarenko2015-09-071-24/+27
| | | | Fixes gh-2056
* Data: remove user data in cleanDataJason Bedard2015-07-281-10/+15
| | | | | Fixes gh-2503 Closes gh-2480
* Manipulation: Remove an internal argument to the remove methodMichał Gołębiowski2015-06-141-25/+29
| | | | | Fixes gh-2301 Closes gh-2366
* Manipulation: privatize internal domManip() functionTimmy Willison2015-05-051-94/+93
| | | | Fixes gh-2225