`).appendTo(cy.$$('body'))
// scroll the 2nd element into view so that
// there is always a scrollTop so we ensure
diff --git a/packages/driver/package.json b/packages/driver/package.json
index ab8cb0ecaaef..81c7aad8bd94 100644
--- a/packages/driver/package.json
+++ b/packages/driver/package.json
@@ -55,7 +55,7 @@
"is-valid-domain": "0.0.20",
"is-valid-hostname": "1.0.1",
"jimp": "0.22.12",
- "jquery": "3.4.1",
+ "jquery": "3.7.1",
"js-cookie": "3.0.5",
"json-stable-stringify": "1.0.1",
"lodash": "^4.17.21",
diff --git a/packages/driver/patches/jquery+3.4.1.dev.patch b/packages/driver/patches/jquery+3.7.1.dev.patch
similarity index 53%
rename from packages/driver/patches/jquery+3.4.1.dev.patch
rename to packages/driver/patches/jquery+3.7.1.dev.patch
index 4b7abd8f32fd..a7d783d95cfe 100644
--- a/packages/driver/patches/jquery+3.4.1.dev.patch
+++ b/packages/driver/patches/jquery+3.7.1.dev.patch
@@ -1,17 +1,17 @@
diff --git a/node_modules/jquery/README.md b/node_modules/jquery/README.md
deleted file mode 100644
-index 411a859..0000000
+index fcc11f3..0000000
--- a/node_modules/jquery/README.md
+++ /dev/null
-@@ -1,67 +0,0 @@
+@@ -1,60 +0,0 @@
-# jQuery
-
-> jQuery is a fast, small, and feature-rich JavaScript library.
-
--For information on how to get started and how to use jQuery, please see [jQuery's documentation](http://api.jquery.com/).
+-For information on how to get started and how to use jQuery, please see [jQuery's documentation](https://api.jquery.com/).
-For source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery).
-
--If upgrading, please see the [blog post for 3.4.1](https://blog.jquery.com/2019/05/01/jquery-3-4-1-triggering-focus-events-in-ie-and-finding-root-elements-in-ios-10/). This includes notable differences from the previous version and a more readable changelog.
+-If upgrading, please see the [blog post for 3.7.1](https://blog.jquery.com/2023/08/28/jquery-3-7-1-released-reliable-table-row-dimensions/). This includes notable differences from the previous version and a more readable changelog.
-
-## Including jQuery
-
@@ -22,95 +22,120 @@ index 411a859..0000000
-#### Script tag
-
-```html
--
+-
-```
-
--#### Babel
+-#### Webpack / Browserify / Babel
-
--[Babel](http://babeljs.io/) is a next generation JavaScript compiler. One of the features is the ability to use ES6/ES2015 modules now, even though browsers do not yet support this feature natively.
+-There are several ways to use [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Babel](https://babeljs.io/). For more information on using these tools, please refer to the corresponding project's documentation. In the script, including jQuery will usually look like this:
-
-```js
-import $ from "jquery";
-```
-
--#### Browserify/Webpack
--
--There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documention. In the script, including jQuery will usually look like this...
+-If you need to use jQuery in a file that's not an ECMAScript module, you can use the CommonJS syntax:
-
-```js
--var $ = require("jquery");
+-var $ = require( "jquery" );
-```
-
-#### AMD (Asynchronous Module Definition)
-
--AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](http://requirejs.org/docs/whyamd.html).
+-AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](https://requirejs.org/docs/whyamd.html).
-
-```js
--define(["jquery"], function($) {
+-define( [ "jquery" ], function( $ ) {
-
--});
+-} );
-```
-
-### Node
-
--To include jQuery in [Node](nodejs.org), first install with npm.
+-To include jQuery in [Node](https://nodejs.org/), first install with npm.
-
-```sh
-npm install jquery
-```
-
--For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/tmpvar/jsdom). This can be useful for testing purposes.
+-For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/jsdom/jsdom). This can be useful for testing purposes.
-
-```js
--require("jsdom").env("", function(err, window) {
-- if (err) {
-- console.error(err);
-- return;
-- }
--
-- var $ = require("jquery")(window);
--});
+-const { JSDOM } = require( "jsdom" );
+-const { window } = new JSDOM( "" );
+-const $ = require( "jquery" )( window );
-```
diff --git a/node_modules/jquery/dist/jquery.js b/node_modules/jquery/dist/jquery.js
-index 773ad95..84ca2f6 100644
+index 1a86433..1c417b1 100644
--- a/node_modules/jquery/dist/jquery.js
+++ b/node_modules/jquery/dist/jquery.js
-@@ -1100,19 +1100,17 @@ setDocument = Sizzle.setDocument = function( node ) {
- docElem = document.documentElement;
- documentIsHTML = !isXML( document );
-
-- // Support: IE 9-11, Edge
-- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
-- if ( preferredDoc !== document &&
-- (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
-+ // Support: IE 9 - 11+, Edge 12 - 18+
-+ // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
-+ // Support: IE 11+, Edge 17 - 18+
-+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
-+ // two documents; shallow comparisons work.
-+ // eslint-disable-next-line eqeqeq
-+ if ( docElem.msMatchesSelector && preferredDoc != document &&
-+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
-
-- // Support: IE 11, Edge
-- if ( subWindow.addEventListener ) {
-- subWindow.addEventListener( "unload", unloadHandler, false );
--
-- // Support: IE 9 - 10 only
-- } else if ( subWindow.attachEvent ) {
-- subWindow.attachEvent( "onunload", unloadHandler );
-- }
-+ // Support: IE 9 - 11+, Edge 12 - 18+
-+ subWindow.addEventListener( "unload", unloadHandler );
- }
+@@ -1419,29 +1419,45 @@ find.matches = function( expr, elements ) {
+ };
+
+ find.matchesSelector = function( elem, expr ) {
+- setDocument( elem );
++ try {
++ // this prevents `is` from calling into the native .matchesSelector method
++ // which would prevent our `focus` code from ever being called during is(:focus).
++ const isUsingFocus = _.includes(expr, ':focus')
+
+- if ( documentIsHTML &&
+- !nonnativeSelectorCache[ expr + " " ] &&
+- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
++ setDocument( elem );
+
+- try {
+- var ret = matches.call( elem, expr );
++ if (!isUsingFocus && documentIsHTML &&
++ !nonnativeSelectorCache[ expr + " " ] &&
++ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
+
+- // IE 9's matchesSelector returns false on disconnected nodes
+- if ( ret || support.disconnectedMatch ||
++ try {
++ var ret = matches.call( elem, expr );
+
+- // As well, disconnected nodes are said to be in a document
+- // fragment in IE 9
+- elem.document && elem.document.nodeType !== 11 ) {
+- return ret;
++ // IE 9's matchesSelector returns false on disconnected nodes
++ if ( ret || support.disconnectedMatch ||
++
++ // As well, disconnected nodes are said to be in a document
++ // fragment in IE 9
++ elem.document && elem.document.nodeType !== 11 ) {
++ return ret;
++ }
++ } catch ( e ) {
++ nonnativeSelectorCache( expr, true );
+ }
+- } catch ( e ) {
+- nonnativeSelectorCache( expr, true );
+ }
+- }
- /* Attributes
-@@ -6534,69 +6491,100 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
- return delta;
+- return find( expr, document, null, [ elem ] ).length > 0;
++ return find( expr, document, null, [ elem ] ).length > 0;
++ } catch (e) {
++ // https://github.com/cypress-io/cypress/issues/21108
++ // When regex starts with =, it is a syntax error when nothing found.
++ // Because Sizzle internally escapes = to handle attribute selectors.
++ // @see https://github.com/jquery/sizzle/blob/20390f05731af380833b5aa805db97de0b91268a/external/jquery/jquery.js#L4363-L4370
++ if (e.message.includes(`Syntax error, unrecognized expression: :cy-contains`)) {
++ return false
++ }
++
++ throw e
++ }
+ };
+
+ find.contains = function( context, elem ) {
+@@ -6647,78 +6663,100 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
+ return delta + marginDelta;
}
-function getWidthOrHeight( elem, dimension, extra ) {
-+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
++function augmentWidthOrHeight( elem, dimension, extra, isBorderBox, styles ) {
+ var i,
+ val = 0;
@@ -128,7 +153,7 @@ index 773ad95..84ca2f6 100644
- valueIsBorderBox = isBorderBox,
+ // Otherwise initialize for horizontal or vertical properties
+ } else {
-+ i = name === "width" ? 1 : 0;
++ i = dimension === "width" ? 1 : 0;
+ }
- val = curCSS( elem, dimension, styles ),
@@ -143,15 +168,26 @@ index 773ad95..84ca2f6 100644
+ // Both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
-+ }
-+
+ }
+- val = "auto";
+- }
+
+ if ( isBorderBox ) {
-+
+
+- // Support: IE 9 - 11 only
+- // Use offsetWidth/offsetHeight for when box sizing is unreliable.
+- // In those cases, the computed value can be trusted to be border-box.
+- if ( ( !support.boxSizingReliable() && isBorderBox ||
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
-+
+
+- // Support: IE 10 - 11+, Edge 15 - 18+
+- // IE/Edge misreport `getComputedStyle` of table rows with width/height
+- // set in CSS while `offset*` properties report correct values.
+- // Interestingly, in some cases IE 9 doesn't suffer from this issue.
+- !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
+ // At this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
@@ -160,32 +196,27 @@ index 773ad95..84ca2f6 100644
+
+ // At this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
-+
+
+- // Fall back to offsetWidth/offsetHeight when value is "auto"
+- // This happens for inline elements with no explicit setting (gh-3571)
+- val === "auto" ||
+ // At this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
- }
-- val = "auto";
- }
++ }
++ }
+- // Support: Android <=4.1 - 4.3 only
+- // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
+- !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
+ return val;
+}
-- // Fall back to offsetWidth/offsetHeight when value is "auto"
-- // This happens for inline elements with no explicit setting (gh-3571)
-- // Support: Android <=4.1 - 4.3 only
-- // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
-- // Support: IE 9-11 only
-- // Also use offsetWidth/offsetHeight for when box sizing is unreliable
-- // We use getClientRects() to check for hidden/disconnected.
-- // In those cases, the computed value can be trusted to be border-box
-- if ( ( !support.boxSizingReliable() && isBorderBox ||
-- val === "auto" ||
-- !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
+- // Make sure the element is visible & connected
- elem.getClientRects().length ) {
-+function getWidthOrHeight( elem, name, extra ) {
-
++function getWidthOrHeight( elem, dimension, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var val,
+ valueIsBorderBox = true,
@@ -203,7 +234,7 @@ index 773ad95..84ca2f6 100644
+ // Running getBoundingClientRect on a disconnected node
+ // in IE throws an error.
+ if ( elem.getClientRects().length ) {
-+ val = elem.getBoundingClientRect()[ name ];
++ val = elem.getBoundingClientRect()[ dimension ];
}
- // Normalize "" and auto
@@ -212,14 +243,14 @@ index 773ad95..84ca2f6 100644
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
-
-- // Adjust for the element's box model
++
+ // Fall back to computed then uncomputed css if necessary
-+ val = curCSS( elem, name, styles );
++ val = curCSS( elem, dimension, styles );
+ if ( val < 0 || val == null ) {
-+ val = elem.style[ name ];
++ val = elem.style[ dimension ];
+ }
-+
+
+- // Adjust for the element's box model
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test( val ) ) {
+ return val;
@@ -228,7 +259,7 @@ index 773ad95..84ca2f6 100644
+ // Check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox &&
-+ ( support.boxSizingReliable() || val === elem.style[ name ] );
++ ( support.boxSizingReliable() || val === elem.style[ dimension ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
@@ -239,8 +270,7 @@ index 773ad95..84ca2f6 100644
- boxModelAdjustment(
+ augmentWidthOrHeight(
elem,
-- dimension,
-+ name,
+ dimension,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
- styles,
@@ -250,4 +280,4 @@ index 773ad95..84ca2f6 100644
+ styles
)
) + "px";
- }
\ No newline at end of file
+ }
diff --git a/packages/driver/src/config/jquery.ts b/packages/driver/src/config/jquery.ts
index 4f28675c3ce9..c28e3a6a304c 100644
--- a/packages/driver/src/config/jquery.ts
+++ b/packages/driver/src/config/jquery.ts
@@ -1,5 +1,4 @@
import JQuery from 'jquery'
-import _ from 'lodash'
import { scrollTo } from './jquery.scrollto'
import $dom from '../dom'
@@ -12,63 +11,6 @@ interface ExtendedJQueryStatic extends JQueryStatic {
const $: ExtendedJQueryStatic = JQuery as any
-// force jquery to have the same visible
-// and hidden logic as cypress
-
-// this prevents `is` from calling into the native .matches method
-// which would prevent our `focus` code from ever being called during
-// is(:focus).
-// see https://github.com/jquery/sizzle/wiki#sizzlematchesselector-domelement-element-string-selector-
-
-// this is to help to interpretor make optimizations around try/catch
-const tryCatchFinally = function ({ tryFn, catchFn, finallyFn }) {
- try {
- return tryFn()
- } catch (e) {
- return catchFn(e)
- } finally {
- finallyFn()
- }
-}
-
-const { matchesSelector } = $.find
-
-$.find.matchesSelector = function (elem, expr) {
- let supportMatchesSelector
- const isUsingFocus = _.includes(expr, ':focus')
-
- if (isUsingFocus) {
- supportMatchesSelector = $.find.support.matchesSelector
- $.find.support.matchesSelector = false
- }
-
- // eslint-disable-next-line prefer-rest-params
- const args = arguments
- const _this = this
-
- return tryCatchFinally({
- tryFn () {
- return matchesSelector.apply(_this, args)
- },
- catchFn (e) {
- // https://github.com/cypress-io/cypress/issues/21108
- // When regex starts with =, it is a syntax error when nothing found.
- // Because Sizzle internally escapes = to handle attribute selectors.
- // @see https://github.com/jquery/sizzle/blob/20390f05731af380833b5aa805db97de0b91268a/external/jquery/jquery.js#L4363-L4370
- if (e.message.includes(`Syntax error, unrecognized expression: :cy-contains`)) {
- return false
- }
-
- throw e
- },
- finallyFn () {
- if (isUsingFocus) {
- $.find.support.matchesSelector = supportMatchesSelector
- }
- },
- })
-}
-
$.fn.scrollTo = scrollTo
// see difference between 'filters' and 'pseudos'
@@ -78,6 +20,8 @@ $.expr.pseudos.focus = $dom.isFocused
$.expr.filters.focus = $dom.isFocused
$.expr.pseudos.focused = $dom.isFocused
+// force jquery to have the same visible
+// and hidden logic as cypress
// we have to add the arrow function here since
// jquery calls this function with additional parameters
// https://github.com/jquery/jquery/blob/master/src/selector.js#L1196
diff --git a/packages/driver/src/cy/commands/actions/focus.ts b/packages/driver/src/cy/commands/actions/focus.ts
index e1b64ef86bfb..996b4964fc0a 100644
--- a/packages/driver/src/cy/commands/actions/focus.ts
+++ b/packages/driver/src/cy/commands/actions/focus.ts
@@ -60,7 +60,7 @@ export default (Commands, Cypress, cy) => {
$elements.isElement(options.$el.get(0)) &&
$elements.isBody(options.$el.get(0))
- // http://www.w3.org/$R/html5/editing.html#specially-focusable
+ // https://dev.w3.org/html5/spec-LC/editing.html#specially-focusable
// ensure there is only 1 dom element in the subject
// make sure its allowed to be focusable
if (!(isWin || isBody || $dom.isFocusable(options.$el))) {
diff --git a/packages/driver/src/cy/commands/actions/scroll.ts b/packages/driver/src/cy/commands/actions/scroll.ts
index 840fe5ca43c7..04b7f31fa958 100644
--- a/packages/driver/src/cy/commands/actions/scroll.ts
+++ b/packages/driver/src/cy/commands/actions/scroll.ts
@@ -381,10 +381,6 @@ export default (Commands, Cypress, cy, state) => {
axis: options.axis,
easing: options.easing,
duration: options.duration,
- // TODO: ensureScrollable option does not exist on jQuery or config/jquery.scrollto.ts.
- // It can be removed.
- // @ts-ignore
- ensureScrollable: options.ensureScrollable,
done () {
return resolve(options.$el)
},
diff --git a/yarn.lock b/yarn.lock
index 00be82360dfb..6d171ada057d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -19901,10 +19901,10 @@ jpeg-js@^0.4.4:
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.4.tgz#a9f1c6f1f9f0fa80cdb3484ed9635054d28936aa"
integrity sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==
-jquery@3.4.1:
- version "3.4.1"
- resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2"
- integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==
+jquery@3.7.1:
+ version "3.7.1"
+ resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
+ integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==
js-beautify@1.14.6, js-beautify@^1.6.12:
version "1.14.6"