aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Core: Formally deprecate push/sort/splice3.x-stableMichał Gołębiowski-Owczarek5 days2-8/+12
| | | | | | | | | | Since we inlined Sizzle into jQuery, we haven't been actually using these three methods internally. Therefore, we could add deprecation warnings in Migrate 3.x for them with jQuery 3.7.0 or newer - both 3.7.0 & 3.7.1 pass all the tests with them removed (while 3.6.4 does not). Some basic tests were added as well. Closes gh-5653
* CSS: Fix dimensions of table `<col>` elementsMichał Gołębiowski-Owczarek2025-02-242-98/+113
| | | | | | | | | | | | | | | | Changes: 1. Fix measurements of `<col span="2">` elements in Firefox. 2. Fix measurements of all implicitly sized `<col>` elements in Safari. Firefox always reports computed width as if `span` was 1. In Safari, computed width for columns is always 0. Work around both issues by using `offsetWidth`. In IE/Edge, `<col>` computed width is `"auto"` unless `width` is set explicitly via CSS so measurements there remain incorrect. Because of the lack of a proper workaround, we accept this limitation. Fixes gh-5628 Closes gh-5634 Ref gh-5630
* Attributes: Support the `until-found` value for the `hidden` attributeMichał Gołębiowski-Owczarek2025-01-161-4/+15
| | | | | | | | | | | | The `hidden` attribute used to be a boolean one but it gained a new `until-found` eventually. This led us to change the way we handle boolean attributes in jQuery 4.0 in gh-5452 to avoid these issues in the future. That said, currently from the attributes we treat as boolean only `hidden` has gained an extra value, let's support it. Closes gh-5607 Ref gh-5388 Ref gh-5452
* Selector: Properly deprecate `jQuery.expr[ ":" ]`/`jQuery.expr.filters`Michał Gołębiowski-Owczarek2024-11-053-6/+5
| | | | | | | Those APIs have formally been deprecated since `3.0.0`, but they never made its way into the deprecated module. Closes gh-5570 Ref gh-5580
* Manipulation: Make jQuery.cleanData not skip elements during cleanupac-mmi2024-09-111-3/+6
| | | | | | | | | | | | | | | When passing a result of `getElementByTagsName` to `jQuery.cleanData`, convert it to an array first. Otherwise, a live NodeList is passed and if any of the event cleanups remove the element itself, a collection is modified during the iteration, making `jQuery.cleanData` skip cleanup for some elements. Fixes gh-5214 Closes gh-5523 Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com> Co-authored-by: Richard Gibson <richard.gibson@gmail.com> (cherry picked from commit 3cad5c435aa2333c39baa55a8bceb2b6bf1e2721)
* Build: upgrade dependencies, including eslint 9.4.0 and uglify 3.7.7Timmy Willison2024-06-157-16/+13
| | | | | | | | | | | | | - Sinon is already at the latest version that supports IE9. - Upgraded uglify to 3.7.7, which is the latest that worked with IE9. I tried 3.9.4, which we are using in jquery-migrate, and 3.8.1, but there were failures in traversing ("Permission denied" errors). - Upgraded eslint to version 9, which required some changes. Mainly, unused arguments in catch expressions error by default in 9+. The config now makes use of `caughtErrorsIgnorePattern`, which is set to `"^_"`, the same as unused function params. - Ignored main branch dist files when switching branches. Closes gh-5508
* CSS:Tests: Fix tests & support tests under CSS Zoom (3.x version)Michał Gołębiowski-Owczarek2024-06-031-3/+3
| | | | | | | | | | | | | | | | Firefox 126+ implements CSS zoom in a way it affects width computed style very slightly (`100.008px` instead of `100px`); accept that difference. Also, skip the width setter under zoom test in Firefox 126 completely - that version has CSS zoom affecting `offsetWidth` values. This has been fixed in Firefox 127 so it's not worth working around it. Add a test for support tests resolving the same under CSS zoom & without one. That test uncovered Chrome failing the `reliableTrDimensions` support test under zoom; the test has been fixed. Fixes gh-5489 Closes gh-5496 Ref gh-5495
* Event: Increase robustness of an inner native event in leverageNativeMichał Gołębiowski-Owczarek2024-05-201-18/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Firefox, alert displayed just before blurring an element dispatches the native blur event twice which tripped the jQuery logic if a jQuery blur handler was not attached before the trigger call. This was because the `leverageNative` logic part for triggering first checked if setup was done before (which, for example, is done if a jQuery handler was registered before for this element+event pair) and - if it was not - added a dummy handler that just returned `true`. The `leverageNative` logic made that `true` then saved into private data, replacing the previous `saved` array. Since `true` passed the truthy check, the second native inner handler treated `true` as an array, crashing on the `slice` call. The same issue could happen if a handler returning `true` is attached before triggering. A bare `length` check would not be enough as the user handler may return an array-like as well. To remove this potential data shape clash, capture the inner result in an object with a `value` property instead of saving it directly. Since it's impossible to call `alert()` in unit tests, simulate the issue by replacing the `addEventListener` method on a test button with a version that calls attached blur handlers twice. Fixes gh-5459 Closes gh-5466 Ref gh-5236 (cherry picked from commit 527fb3dcf0dcde69302a741dfc61cbfa58e99eb0)
* Manipulation: Support $el.html(selfRemovingScript)Richard Gibson2024-01-081-1/+3
| | | | | | | | | Don't try to remove a script element that has already removed itself. Fixes gh-5377 Closes gh-5378 (cherry-picked from commit 937923d9ee8dfd19008447b5059cbd13ee5a23ac)
* CSS: Fix reliableTrDimensions test for initially hidden iframes (3.x)Michał Gołębiowski-Owczarek2023-11-072-1/+13
| | | | | | | | Also, account for the fact old Firefox (<61) has `null` computed style for elements in such iframes. Closes gh-5359 Ref gh-5317 Ref gh-5358
* CSS: Fix support test results for initially hidden iframesStephen Sigwart2023-11-021-0/+6
| | | | | | | | | | If the iframe is not initially visible, the `scrollboxSize` support test is failing. jQuery then cached this value and and applied the wrong result undefinitely. This breaks jQuery UI's Dialogs inside initially invisible iframes. Closes gh-5317 Ref jquery/jquery-ui#2176
* Build: migrate most grunt tasks off of grunt (3.x)Timmy Willison2023-09-201-45/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close gh-5330 - lint - npmcopy - build, minify, and process for distribution. - new custom build command using yargs - compare size of minified/gzip built files - pretest scripts, including qunit-fixture, babel transpilation, and npmcopy - node smoke tests - promises aplus tests - new watch task using nodemon, which runs `npm run build:all` on `src` changes. Also: - upgraded husky and added the new lint command - updated lint config to use new "flat" config format. See https://eslint.org/docs/latest/use/configure/configuration-files-new - Temporarily disabled one lint rule until flat config is supported by eslint-plugin-import. See https://github.com/import-js/eslint-plugin-import/issues/2556 - committed package-lock.json - updated all test scripts to use the new build - added an express test server that uses middleware-mockserver this can be used to run tests without karma - build-all-variants is now build:all - run pretest script in jenkins --------- Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
* Core: Simplify code post browser support reductionMichał Gołębiowski-Owczarek2023-09-202-1/+5
| | | | | | | | | | | | | | | | | | | Summary of the changes: * 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 (cherry picked from commit 93ca49e6d1ac23fee33b3bc3b7f4d93dd1a25cb7)
* CSS: Make the reliableTrDimensions support test work with Bootstrap CSS (3.x ↵Michał Gołębiowski-Owczarek2023-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | version) Bootstrap 5 includes the following CSS on the page: ```css *, *::before, *::after { box-sizing: border-box; } ``` That threw our `reliableTrDimensions` support test off. This change fixes the support test and adds a unit test ensuring support test values on a page including Bootstrap 5 CSS are the same as on a page without it. Fixes gh-5270 Closes gh-5279 Ref gh-5278
* Selector: Only attach the unload handler in IE & Edge LegacyMichał Gołębiowski-Owczarek2023-07-101-6/+11
| | | | | | | | | | | | | | | | Both IE & Edge Legacy need the workaround of calling `setDocument()` in an `unload` handler to avoid "permission denied" errors. However, due to not being possible to feature-detect this issue, the handler has been applied in all browsers for windows different than the one in which jQuery was loaded. jQuery 4.0, which drops Edge Legacy support, guards this workaround with a `document.documentMode` check. This won't work in the 3.x line due to still supporting Edge Legacy but we can check for `document.documentElement.msMatchesSelector` instead as that API is supported in IE 9+ and all Edge Legacy versions. Fixes gh-5281 Closes gh-5282 Ref gh-4792
* Docs: Fix typos found by codespellDimitri Papadopoulos Orfanos2023-06-281-1/+1
| | | | | | Closes gh-5165 (cherry picked from commit 620870a1af5287d29c77ec6d5f973116b23793a7)
* Core: Fix regression in jQuery.text() on HTMLDocument objectsTimo Tijhof2023-06-121-2/+7
| | | | Fixes gh-5264 Closes gh-5265
* Selector: Re-expose jQuery.find.tokenize (3.x version)Michał Gołębiowski-Owczarek2023-06-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | `Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result, it has historically been available in jQuery via `jQuery.find.tokenize`. That got dropped during Sizzle removal; this change restores the API. In addition to that, Sizzle tests have been backported for the following APIs: * `jQuery.find.matchesSelector` * `jQuery.find.matches` * `jQuery.find.compile` * `jQuery.find.select` A new test was also added for `jQuery.find.tokenize` - even Sizzle was missing one. Fixes gh-5259 Closes gh-5260 Ref gh-5263 Ref jquery/sizzle#242 Ref gh-5113 Ref gh-4395 Ref gh-4406
* Deprecated: Define `.hover()` using non-deprecated methodsMichał Gołębiowski-Owczarek2023-05-221-1/+3
| | | | | | | | | Make the deprecated `.hover()` method not rely on other deprecated methods: `.mouseenter()` & `.mouseleave()`. Use `.on()` instead. Closes gh-5251 (cherry picked from commit fd6ffc5eb2c12562f2656d2f33865448420252be)
* Tests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (3.x ↵Michał Gołębiowski-Owczarek2023-04-051-2/+2
| | | | | | | | | | | | version) Chrome 112 & Safari 16.4 introduce two changes: * `:has()` is non-forgiving * `CSS.supports( "selector(...)" )` parses everything in a non-forgiving way We no longer care about the latter but the former means the `cssHas` support test now passes. Closes gh-5226
* CSS: Make `offsetHeight( true )`, etc. include negative marginsMichał Gołębiowski-Owczarek2023-04-041-3/+6
| | | | | | | | | | | | | | | This regressed in gh-3656 as the added logic to include scroll gutters in `.innerWidth()` / `.innerHeight()` didn't take negative margins into account. This broke handling of negative margins in `.offsetHeight( true )` and `.offsetWidth( true )`. To fix it, calculate margin delta separately and only add it after the scroll gutter adjustment logic. Fixes gh-3982 Closes gh-5234 Ref gh-3656 (cherry picked from commit bce13b72c1753e16cc0db53ebf0f0456bdcf6b48)
* Event: Simplify the check for saved data in leverageNativeMichał Gołębiowski-Owczarek2023-04-031-1/+1
| | | | | | | | | | | | | Previously, when `leverageNative` handled async events, there was a case where an empty placeholder object was set as a result. Covering both such an object and `false` required a `length` check. However, this is not necessary since gh-5223 and the check was already simplified in other places; this one was missed. Closes gh-5236 Ref gh-5223 (cherry picked from commit dfe212d5a1eed6b4a67d1cbd04ece09bbac33699)
* Selector: Remove an obsolete commentMichał Gołębiowski-Owczarek2023-04-031-2/+0
| | | | | | | | | | There was a comment claiming that there are two implementations of `safeActiveElement`. However, the one in `event.js` got removed in gh-5224, even before the comment was added. This commit removes this obsolete comment. Closes gh-5237 Ref gh-5224
* CSS: Add missing jQuery.cssNumber entriesMichał Gołębiowski-Owczarek2023-03-271-20/+29
| | | | | | | | | | | New entries cover `aspect-ratio`, `scale`, and a few others. Also, remove quotes around `cssNumber` keys A few properties have been taken from React: https://github.com/facebook/react/blob/afea1d0c536e0336735b0ea5c74f635527b65785/packages/react-dom-bindings/src/shared/CSSProperty.js\#L8-L58 Fixes gh-5179 Closes gh-5233
* Selector: Wrap activeElement access in try-catchMichał Gołębiowski-Owczarek2023-03-271-1/+12
| | | | | | | In IE 9 accessing `document.activeElement` may throw; see https://bugs.jquery.com/ticket/13393. We've already guarded against this in event code but not in selector. Closes gh-5229
* Event: Make trigger(focus/blur/click) work with native handlersMichał Gołębiowski-Owczarek2023-03-271-4/+12
| | | | | | | | | | | | | | | | | | | | | In `leverageNative`, instead of calling `event.stopImmediatePropagation()` which would abort both native & jQuery handlers, set the wrapper's `isImmediatePropagationStopped` property to a function returning `true`. Since for each element + type pair jQuery attaches only one native handler, there is also only one wrapper jQuery event so this achieves the goal: on the target element jQuery handlers don't fire but native ones do. Unfortunately, this workaround doesn't work for handlers on ancestors - since the native event is re-wrapped by a jQuery one on each level of the propagation, the only way to stop it for jQuery was to stop it for everyone via native `stopPropagation()`. This is not a problem for `focus`/`blur` which don't bubble, but it does also stop `click` on checkboxes and radios. We accept this limitation. Fixes gh-5015 Closes gh-5228 (cherry picked from commit 6ad3651dbfea9e9bb56e608f72b4ef2f97bd4e70)
* Event: Simulate focus/blur in IE via focusin/focusout (3.x version)Michał Gołębiowski-Owczarek2023-03-274-124/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In IE (all versions), `focus` & `blur` handlers are fired asynchronously but `focusin` & `focusout` are run synchronously. In other browsers, all those handlers are fired synchronously. Asynchronous behavior of these handlers in IE caused issues for IE (gh-4856, gh-4859). We now simulate `focus` via `focusin` & `blur` via `focusout` in IE to avoid these issues. This also let us simplify some tests. This commit also simplifies `leverageNative` - with IE now using `focusin` to simulate `focus` and `focusout` to simulate `blur`, we don't have to deal with async events in `leverageNative`. This also fixes broken `focus` triggers after first triggering it on a hidden element - previously, `leverageNative` assumed that the native `focus` handler not firing after calling the native `focus` method meant it would be handled later, asynchronously, which was not the case (gh-4950). To preserve relative `focusin`/`focus` & `focusout`/`blur` event order guaranteed on the 3.x branch, attach a single handler for both events in IE. A side effect of this is that to reduce size the `event/focusin` module no longer exists and it's impossible to disable the `focusin` patch in modern browsers via the jQuery custom build system. Fixes gh-4856 Fixes gh-4859 Fixes gh-4950 Ref gh-5223 Closes gh-5224 Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
* Deferred: Rename `getStackHook` to `getErrorHook` (3.x version)Michał Gołębiowski-Owczarek2023-03-142-6/+17
| | | | | | | | | | | | | | Rename `jQuery.Deferred.getStackHook` to `jQuery.Deferred.getErrorHook` to indicate passing an error instance is usually a better choice - it works with source maps while a raw stack generally does not. In jQuery `3.7.0`, we'll keep both names, marking the old one as deprecated. In jQuery `4.0.0` we'll just keep the new one. This change implements the `3.7.0` version; PR gh-5211 implements the `4.0.0` one. Fixes gh-5201 Closes gh-5212 Ref gh-5211
* Selector: Stop relying on CSS.supports( "selector(...)" )Michał Gołębiowski-Owczarek2023-02-141-60/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | `CSS.supports( "selector(...)" )` has different semantics than selectors passed to `querySelectorAll`. Apart from the fact that the former returns `false` for unrecognized selectors and the latter throws, `qSA` is more forgiving and accepts some invalid selectors, auto-correcting them where needed - for example, mismatched brackers are auto-closed. This behavior difference is breaking for many users. To add to that, a recent CSSWG resolution made `:is()` & `:where()` the only pseudos with forgiving parsing; browsers are in the process of making `:has()` parsing unforgiving. Taking all that into account, we go back to our previous try-catch approach without relying on `CSS.supports( "selector(...)" )`. The only difference is we detect forgiving parsing in `:has()` and mark the selector as buggy. The PR also updates `playwright-webkit` so that we test against a version of WebKit that already has non-forgiving `:has()`. Fixes gh-5194 Closes gh-5207 Ref gh-5206 Ref gh-5098 Ref gh-5107 Ref w3c/csswg-drafts#7676
* Selector: Rename rcombinators to rleadingCombinatorMichał Gołębiowski-Owczarek2023-02-131-3/+3
| | | Closes gh-5208
* Selector: Make selector lists work with `qSA` againMichał Gołębiowski-Owczarek2022-12-191-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | jQuery 3.6.2 started using `CSS.supports( "selector(SELECTOR)" )` before using `querySelectorAll` on the selector. This was to solve gh-5098 - some selectors, like `:has()`, now had their parameters parsed in a forgiving way, meaning that `:has(:fakepseudo)` no longer throws but just returns 0 results, breaking that jQuery mechanism. A recent spec change made `CSS.supports( "selector(SELECTOR)" )` always use non-forgiving parsing, allowing us to use this API for what we've used `try-catch` before. To solve the issue on the spec side for older jQuery versions, `:has()` parameters are no longer using forgiving parsing in the latest spec update but our new mechanism is more future-proof anyway. However, the jQuery implementation has a bug - in `CSS.supports( "selector(SELECTOR)" )`, `SELECTOR` needs to be a `<complex-selector>` and not a `<complex-selector-list>`. Which means that selector lists now skip `qSA` and go to the jQuery custom traversal: ```js CSS.supports("selector(div:valid, span)"); // false CSS.supports("selector(div:valid)"); // true CSS.supports("selector(span)"); // true ``` To solve this, this commit wraps the selector list passed to `CSS.supports( "selector(:is(SELECTOR))" )` with `:is`, making it a single selector again. See: * https://w3c.github.io/csswg-drafts/css-conditional-4/#at-supports-ext * https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector * https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector-list Fixes gh-5177 Closes gh-5178 Ref w3c/csswg-drafts#7280 (cherry picked from commit 09d988b774e7ff4acfb69c0cde2dab373559aaca)
* Selector: Implement the `uniqueSort` chainable methodMichał Gołębiowski-Owczarek2022-12-142-1/+10
| | | | | | | | | | | | Some APIs, like `.prevAll()`, return elements in the reversed order, causing confusing behavior when used with wrapping methods (see gh-5149 for more info) To provide an easy workaround, this commit implements a chainable `uniqueSort` method on jQuery objects, an equivalent of `jQuery.uniqueSort`. Fixes gh-5166 Closes gh-5168 (cherry picked from commit 5266f23cf49c9329bddce4d4af6cb5fbbd1e0383)
* Selector: Inline Sizzle into the selector module: 3.x version (#5113)Michał Gołębiowski-Owczarek2022-12-1415-118/+2297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes Sizzle from jQuery, inlining its code & removing obsolete workarounds where applicable. 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 main `selector` module can be disabled in favor of `selector-native` via: grunt custom:-selector For backwards compatibility, the legacy `sizzle` alias is also supported (it will be dropped in jQuery `4.0.0`): grunt custom:-selector Sizzle tests have been ported to jQuery ones. Ones that are not compatible with the `selector-native` module are disabled if the regular selector module is excluded. Backwards compatibility is still kept for all `Sizzle` utils - they continue to be available under `jQuery.find` - but the primary implementation is now attached directly to jQuery. Some selector utils shared by `selector` & `selector-native` have been extracted & deduplicated. `jQuery.text` and `jQuery.isXMLDoc` have been moved to the `core` module. The commit reduces the gzipped jQuery size by 851 bytes compared to the `3.x-stable` branch. Closes gh-5113 Ref gh-4395 Ref gh-4406
* Selector:Manipulation: Fix DOM manip within template contentsMichał Gołębiowski-Owczarek2022-11-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | The `<template/>` element `contents` property is a document fragment that may have a `null` `documentElement`. In Safari 16 this happens in more cases due to recent spec changes - in particular, even if that document fragment is explicitly adopted into an outer document. We're testing both of those cases now. The crash used to happen in `jQuery.contains` which is an alias for `Sizzle.contains` in jQuery 3.x. The Sizzle fix is at jquery/sizzle#490, released in Sizzle `2.3.8`. This version of Sizzle is included in the parent commit. A fix similar to the one from gh-5158 has also been applied here to the `selector-native` version. Fixes gh-5147 Closes gh-5159 Ref jquery/sizzle#490 Ref gh-5158
* CSS: Return `undefined` for whitespace-only CSS variable values (#5120)Michał Gołębiowski-Owczarek2022-10-031-4/+24
| | | | | | | | | | | | | | | | | | | The spec requires that CSS variable values are trimmed. In browsers that do this - mainly, Safari, but also Firefox if the value only has leading whitespace - we currently return undefined; in other browsers, we return an empty string as the logic to fall back to undefined happens before trimming. This commit adds another explicit callback to `undefined` to have it consistent across browsers. Also, more explicit comments about behaviors we need to work around in various browsers have been added. Closes gh-5120 Ref gh-5106 (cherry picked from commit 7eb0019640a5856c42b451551eb7f995d913eba9)
* CSS: Don’t trim whitespace of undefined custom propertyAnders Kaseorg2022-09-191-1/+1
| | | | | | | | | Fixes gh-5105 Closes gh-5106 Signed-off-by: Anders Kaseorg <andersk@mit.edu> (cherry picked from commit ed306c0261ab63746040e5d58bb4477c3069a427)
* Deprecated: Improve $.trim performance for strings with lots of whitespaceVladimir Sitnikov2022-07-201-2/+4
| | | | | | | | | | Regex imp implementation takes `O(N^2)` time to trim the string when multiple adjacent spaces were present. The new expression require that the "whitespace run" starts from a non-whitespace to avoid `O(N^2)` behavior when the engine would try matching `\s+$` at each space position. Closes gh-5068
* CSS: Skip falsy values in `addClass( array )`, compress codeMichał Gołębiowski-Owczarek2022-01-251-36/+34
| | | | | | | | | | | | | | | | | | This change makes jQuery skip falsy values in `addClass( array )` & `removeClass( array )` instead of stopping iteration when the first falsy value is detected. This makes code like: ```js elem.addClass( [ "a", "", "b" ] ); ``` add both the `a` & `b` classes. The code was also optimized for size a bit so it doesn't increase the minified gzipped size. Fixes gh-4998 Closes gh-5003 (partially cherry picked from commit a338b407f2479f82df40635055effc163835183f)
* Docs: Replace `#NUMBER` Trac issue references with `trac-NUMBER`Michał Gołębiowski-Owczarek2022-01-1226-46/+46
| | | | | | | | | | | | | | | | | This is a version of gh-4993 for the `3.x-stable` branch. 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-4994 Ref gh-4993 Ref 5d5ea015114092c157311c4948f7cc3d8c8e7f8a
* Docs: Remove links to Web Archive from sourceMichał Gołębiowski-Owczarek2022-01-042-2/+0
| | | | | | | | | | | Neither of the removed links is crucial; one of them refers to a site that has since started being malicious; while the Web Archive links remain safe, some scanners warn about such links. Removing them is the safest thing to do. Fixes gh-4981 Closes gh-4991 (cherry picked from commit e24f2dcf3f6bda1a672502e0233c732065cbbe89)
* CSS: Justify use of rtrim on CSS property valuesRichard Gibson2022-01-031-0/+6
| | | | | | | | | | CSS does not acknowledge carriage return or form feed characters as whitespace but it does replace them with whitespace, making it acceptable to use `rtrim`. Closes gh-4956 (cherry picked from commit 655c0ed5e204b1f6427e09d615a49586a7bc84eb)
* CSS: Remove a redundant extension from rtrimCSS inclusion in curCSSMichał Gołębiowski-Owczarek2021-10-191-1/+1
| | | | This breaks the AMD mode.
* CSS: Trim whitespace surrounding CSS Custom Properties valuesfecore12021-10-185-4/+41
| | | | | | | | | | | The spec has recently changed and CSS Custom Properties values are trimmed now. This change makes jQuery polyfill that new behavior for all browsers. Ref w3c/csswg-drafts#774 Fixes gh-4926 Closes gh-4930 (partially cherry picked from commit efadfe991a5c287af561a9326bf1427d726c91c1)
* Manipulation: Don't remove HTML comments from scriptsMichał Gołębiowski-Owczarek2021-07-191-1/+8
| | | | | | | | | | | | | | | | | | | | | 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 still need to strip CDATA sections for backwards compatibility. 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 but we're preserving that logic for backwards compatibility. This will be removed completely in 4.0. Fixes gh-4904 Closes gh-4905 Ref gh-4906
* Event: Don't break focus triggering after `.on(focus).off(focus)`Michał Gołębiowski-Owczarek2021-05-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | The `_default` function in the special event settings for focus/blur has always returned `true` since gh-4813 as the event was already being fired from `leverageNative`. However, that only works if there's an active handler on that element; this made a quick consecutive call: ```js elem.on( "focus", function() {} ).off( "focus" ); ``` make subsequent `.trigger( "focus" )` calls to not do any triggering. The solution, already used in a similar `_default` method for the `click` event, is to check for the `dataPriv` entry on the element for the focus event (similarly for blur). Fixes gh-4867 Closes gh-4885 (cherry picked from commit e539bac79e666bba95bba86d690b4e609dca2286)
* Support: ensure display is set to block for the support div (#4844)Timmy Willison2021-02-161-0/+8
| | | | | | - Fixes an issue with the support test in iframes in Android 8 Chrome 86+, where display: inline resulted in unexpected height values. Fixes gh-4832
* Deferred: Rename master to primaryMichał Gołębiowski-Owczarek2021-01-121-8/+8
| | | | | | Closes gh-4828 (cherry picked from a32cf6324f8f2190e66a687e94be9687ebf840b7)
* Dimensions: Modify reliableTrDimensions support test to account for FFTimmy Willison2021-01-111-2/+13
| | | | | | | | | Firefox incorrectly (or perhaps correctly) includes table borders in computed dimensions, but they are the only one. Workaround this by testing for it and falling back to offset properties Fixes gh-4529 Closes gh-4807
* Core: Report browser errors in parseXMLMichał Gołębiowski-Owczarek2020-12-081-6/+11
| | | | | | | Fixes gh-4784 Closes gh-4816 (cherry picked from commit 8969732518470a7f8e654d5bc5be0b0076cb0b87)
* Event: Make focus re-triggering not focus the original element backMichał Gołębiowski-Owczarek2020-12-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If during a focus handler another focus event is triggered: ```js elem1.on( "focus", function() { elem2.trigger( "focus" ); } ); ``` due to their synchronous nature everywhere outside of IE the hack added in gh-4279 to leverage native events causes the native `.focus()` method to be called last for the initial element, making it steal the focus back. Since the native method is already being called in `leverageNative`, we can skip that final call. This aligns with changes to the `_default` method for the `click` event that were added when `leverageNative` was introduced there. A side effect of this change is that now `focusin` will only propagate to the document for the last focused element. This is a change in behavior but it also aligns us better with how this works with native methods. Fixes gh-4382 Closes gh-4813 Ref gh-4279 (cherry picked from commit dbcffb396c2db61ff96edc4162602e850797d61f)