Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency: Update jquery to 3.4.1 #29837

Merged
merged 12 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ _Released 7/16/2024 (PENDING)_

**Bugfixes:**

- Fixed an issue where the ReadStream used to upload a Test Replay recording could erroneously be re-used when retrying in cases of retryable upload failures. Fixes [#29227](https://github.com/cypress-io/cypress/issues/29227)
- Fixed an issue where the ReadStream used to upload a Test Replay recording could erroneously be re-used when retrying in cases of retryable upload failures. Fixes [#29227](https://github.com/cypress-io/cypress/issues/29227).

**Dependency Updates:**

- Updated `jquery` from `3.1.1` to `3.4.1`. Addressed in [#29837](https://github.com/cypress-io/cypress/pull/29837).

## 13.13.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
"**/@types/cheerio": "0.22.21",
"**/@types/enzyme": "3.10.5",
"**/@types/react": "16.9.50",
"**/jquery": "3.1.1",
"**/jquery": "3.4.1",
"**/pretty-format": "26.4.0",
"**/sharp": "0.29.3",
"**/socket.io-parser": "4.0.5",
Expand Down
10 changes: 3 additions & 7 deletions packages/driver/cypress/e2e/commands/actions/click.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4103,10 +4103,10 @@ describe('mouse state', () => {
const coordsChrome = {
clientX: 492,
clientY: 9,
layerX: 492,
layerY: 215,
Comment on lines -4106 to -4107
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layerX and layerY properties are non-standard. We already had these mouse props commented out for Firefox because it was returning odd results. I'm removing the tests for these non-standard properties on all browsers. https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/layerX

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

pageX: 492,
pageY: 215,
// pageY is 220.5 in headless Electron
// since updating to jquery 3.2+....why...
// pageY: 215,
Comment on lines +4107 to +4109
Copy link
Member Author

@jennifer-shehane jennifer-shehane Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pageY value returns 220.5 in headless Electron. It is 215 in headed, it is 215 in Chrome, it is 215 in the version of Chromium 118 that I could find. I commented this out. I have no earthly idea why a change in jQuery would result in this pageY value being slightly different when clicking from 1 div to another div in Electron headless. I'm not sure that this quirk is worth further investigation, but open for debate.

screenX: 492,
screenY: 9,
x: 492,
Expand All @@ -4117,8 +4117,6 @@ describe('mouse state', () => {
const coordsFirefox = {
clientX: 494,
clientY: 10,
// layerX: 492,
// layerY: 215,
pageX: 494,
pageY: 226,
screenX: 494,
Expand All @@ -4130,8 +4128,6 @@ describe('mouse state', () => {
const coordsWebKit = {
clientX: 500,
clientY: 10,
layerX: 500,
layerY: 226,
pageX: 500,
pageY: 226,
screenX: 500,
Expand Down
26 changes: 15 additions & 11 deletions packages/driver/cypress/e2e/commands/actions/scroll.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ describe('src/cy/commands/actions/scroll', () => {

this.scrollBoth.scrollTop = 0
this.scrollBoth.scrollLeft = 0

// width/height of scrollable container - width of parent viewport (minux scrollbars) / 2 to get the center
// browsers round up the pixel value so we need to round it
this.halfScrollPixels = Math.round((500 - 100) / 2)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just moving this calc to one place with some explanation because it took me a while to figure out these values from thin air.

})

describe('subject', () => {
Expand Down Expand Up @@ -86,7 +90,7 @@ describe('src/cy/commands/actions/scroll', () => {
// in the percentage of the scroll (since going the height
// of the container wouldn't scroll at all...)
expect(this.scrollHoriz.get(0).scrollTop).to.eq(0)
expect(this.scrollHoriz.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})
})
Expand All @@ -108,7 +112,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('top').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(0)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})

Expand All @@ -127,7 +131,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('left').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)
})
})
Expand All @@ -137,8 +141,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('center').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})

Expand All @@ -147,7 +151,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('right').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100))
})
})
Expand All @@ -168,7 +172,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('bottom').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100))
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})

Expand Down Expand Up @@ -229,8 +233,8 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('50%', '50%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})

Expand All @@ -239,7 +243,7 @@ describe('src/cy/commands/actions/scroll', () => {
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get('#scroll-to-both').scrollTo('0%', '50%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0)
})
})
Expand All @@ -250,7 +254,7 @@ describe('src/cy/commands/actions/scroll', () => {

cy.get('#scroll-to-both').scrollTo('50%', '0%').then(function () {
expect(this.scrollBoth.get(0).scrollTop).to.eq(0)
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100) / 2)
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"is-valid-domain": "0.0.20",
"is-valid-hostname": "1.0.1",
"jimp": "0.22.12",
"jquery": "3.1.1",
"jquery": "3.4.1",
"js-cookie": "3.0.5",
"json-stable-stringify": "1.0.1",
"lodash": "^4.17.21",
Expand Down
223 changes: 223 additions & 0 deletions packages/driver/patches/jquery+3.4.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
diff --git a/node_modules/jquery/README.md b/node_modules/jquery/README.md
deleted file mode 100644
index 411a859..0000000
--- a/node_modules/jquery/README.md
+++ /dev/null
@@ -1,67 +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 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.
-
-## Including jQuery
-
-Below are some of the most common ways to include jQuery.
-
-### Browser
-
-#### Script tag
-
-```html
-<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
-```
-
-#### 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.
-
-```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...
-
-```js
-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).
-
-```js
-define(["jquery"], function($) {
-
-});
-```
-
-### Node
-
-To include jQuery in [Node](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.
-
-```js
-require("jsdom").env("", function(err, window) {
- if (err) {
- console.error(err);
- return;
- }
-
- var $ = require("jquery")(window);
-});
-```
diff --git a/node_modules/jquery/dist/jquery.js b/node_modules/jquery/dist/jquery.js
index 773ad95..9e6076f 100644
--- a/node_modules/jquery/dist/jquery.js
+++ b/node_modules/jquery/dist/jquery.js
@@ -6534,69 +6534,100 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
return delta;
}

-function getWidthOrHeight( elem, dimension, extra ) {
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i,
+ val = 0;

- // Start with computed style
- var styles = getStyles( elem ),
+ // If we already have the right measurement, avoid augmentation
+ if ( extra === ( isBorderBox ? "border" : "content" ) ) {
+ i = 4;

- // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
- // Fake content-box until we know it's needed to know the true value.
- boxSizingNeeded = !support.boxSizingReliable() || extra,
- isBorderBox = boxSizingNeeded &&
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
- valueIsBorderBox = isBorderBox,
+ // Otherwise initialize for horizontal or vertical properties
+ } else {
+ i = name === "width" ? 1 : 0;
+ }

- val = curCSS( elem, dimension, styles ),
- offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
+ for ( ; i < 4; i += 2 ) {

- // Support: Firefox <=54
- // Return a confounding non-pixel value or feign ignorance, as appropriate.
- if ( rnumnonpx.test( val ) ) {
- if ( !extra ) {
- return val;
+ // Both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // 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 );
+ }
+ } else {
+
+ // At this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // 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";
}

+ 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" ) &&
- elem.getClientRects().length ) {
+function getWidthOrHeight( elem, name, extra ) {

+ // Start with offset property, which is equivalent to the border-box value
+ var val,
+ valueIsBorderBox = true,
+ styles = getStyles( elem ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

- // Where available, offsetWidth/offsetHeight approximate border box dimensions.
- // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
- // retrieved value as a content box dimension.
- valueIsBorderBox = offsetProp in elem;
- if ( valueIsBorderBox ) {
- val = elem[ offsetProp ];
- }
+ // Support: IE <=11 only
+ // Running getBoundingClientRect on a disconnected node
+ // in IE throws an error.
+ if ( elem.getClientRects().length ) {
+ val = elem.getBoundingClientRect()[ name ];
}

- // Normalize "" and auto
- val = parseFloat( val ) || 0;
+ // Some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // 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 );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test( val ) ) {
+ return val;
+ }
+
+ // 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 ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // Use the active box-sizing model to add/subtract irrelevant styles
return ( val +
- boxModelAdjustment(
+ augmentWidthOrHeight(
elem,
- dimension,
+ name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
- styles,
-
- // Provide the current computed size to request scroll gutter calculation (gh-3589)
- val
+ styles
)
) + "px";
}
Loading
Loading