diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2025-02-24 18:27:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 18:27:30 +0100 |
commit | e2fe97b7f15cf5ee2e44566b381f7bf214e491b1 (patch) | |
tree | b49830d562f84fee5b887e87e8864b24bedf1e05 | |
parent | 7c123dec4b96e7c3ce5f5a78e828c8aa335bea98 (diff) | |
download | jquery-e2fe97b7f15cf5ee2e44566b381f7bf214e491b1.tar.gz jquery-e2fe97b7f15cf5ee2e44566b381f7bf214e491b1.zip |
Core: Remove obsolete workarounds, update support comments
Closes gh-5625
-rw-r--r-- | src/css.js | 2 | ||||
-rw-r--r-- | src/css/curCSS.js | 5 | ||||
-rw-r--r-- | src/css/support.js | 7 | ||||
-rw-r--r-- | src/selector/rbuggyQSA.js | 1 | ||||
-rw-r--r-- | test/unit/css.js | 23 | ||||
-rw-r--r-- | test/unit/dimensions.js | 23 | ||||
-rw-r--r-- | test/unit/event.js | 2 | ||||
-rw-r--r-- | test/unit/manipulation.js | 10 | ||||
-rw-r--r-- | test/unit/offset.js | 24 | ||||
-rw-r--r-- | test/unit/selector.js | 6 | ||||
-rw-r--r-- | test/unit/support.js | 24 |
11 files changed, 30 insertions, 97 deletions
diff --git a/src/css.js b/src/css.js index 72a807bfc..3e7073507 100644 --- a/src/css.js +++ b/src/css.js @@ -151,7 +151,7 @@ function getWidthOrHeight( elem, dimension, extra ) { // Support: IE 10 - 11+ // IE misreports `getComputedStyle` of table rows with width/height // set in CSS while `offset*` properties report correct values. - // Support: Firefox 70+ + // Support: Firefox 70 - 135+ // Firefox includes border widths // in computed dimensions for table rows. (gh-4529) ( !support.reliableTrDimensions() && nodeName( elem, "tr" ) ) ) && diff --git a/src/css/curCSS.js b/src/css/curCSS.js index b0f0a7555..942017bbe 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -30,10 +30,9 @@ export function curCSS( elem, name, computed ) { if ( isCustomProp && ret ) { - // Support: Firefox 105+, Chrome <=105+ + // Support: Firefox 105 - 135+ // Spec requires trimming whitespace for custom properties (gh-4926). - // Firefox only trims leading whitespace. Chrome just collapses - // both leading & trailing whitespace to a single space. + // Firefox only trims leading whitespace. // // Fall back to `undefined` if empty string returned. // This collapses a missing definition with property defined diff --git a/src/css/support.js b/src/css/support.js index 93459c6b6..bca0b6dbf 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -25,12 +25,7 @@ support.reliableTrDimensions = function() { tr = document.createElement( "tr" ); table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "box-sizing:content-box;border:1px solid"; - - // Support: Chrome 86+ - // Height set through cssText does not get applied. - // Computed height then comes back as 0. - tr.style.height = "1px"; + tr.style.cssText = "box-sizing:content-box;border:1px solid;height:1px"; div.style.height = "9px"; // Support: Android Chrome 86+ diff --git a/src/selector/rbuggyQSA.js b/src/selector/rbuggyQSA.js index b056ffe75..acd277554 100644 --- a/src/selector/rbuggyQSA.js +++ b/src/selector/rbuggyQSA.js @@ -25,7 +25,6 @@ if ( isIE ) { if ( !support.cssHas ) { - // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ // Our regular `try-catch` mechanism fails to detect natively-unsupported // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) // in browsers that parse the `:has()` argument as a forgiving selector list. diff --git a/test/unit/css.js b/test/unit/css.js index e232f5db0..8a96fb357 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1379,7 +1379,7 @@ testIframe( function( assert, jQuery, window, document, widthBeforeSet, widthAfterSet ) { assert.expect( 2 ); - // Support: Firefox 126+ + // Support: Firefox 126 - 135+ // Newer Firefox implements CSS zoom in a way it affects // those values slightly. assert.ok( /^100(?:|\.0\d*)px$/.test( widthBeforeSet ), "elem.css('width') works correctly with browser zoom" ); @@ -1812,14 +1812,9 @@ QUnit.testUnlessIE( "css(--customProperty)", function( assert ) { var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ), $elem = jQuery( "<div>" ).addClass( "test__customProperties" ) - .appendTo( "#qunit-fixture" ), - webkitOrBlink = /webkit\b/i.test( navigator.userAgent ), - expected = 20; + .appendTo( "#qunit-fixture" ); - if ( webkitOrBlink ) { - expected -= 2; - } - assert.expect( expected ); + assert.expect( 20 ); div.css( "--color", "blue" ); assert.equal( div.css( "--color" ), "blue", "Modified CSS custom property using string" ); @@ -1848,13 +1843,15 @@ QUnit.testUnlessIE( "css(--customProperty)", function( assert ) { assert.equal( $elem.css( "--prop5" ), "val5", "Multiple Following whitespace trimmed" ); assert.equal( $elem.css( "--prop6" ), "val6", "Preceding and Following whitespace trimmed" ); assert.equal( $elem.css( "--prop7" ), "val7", "Multiple preceding and following whitespace trimmed" ); + assert.equal( $elem.css( "--prop8" ), "\"val8\"", "Works with double quotes" ); - // Support: Chrome <=49 - 73+, Safari <=9.1 - 12.1+ - // Chrome treats single quotes as double ones. - // Safari treats double quotes as single ones. - if ( !webkitOrBlink ) { - assert.equal( $elem.css( "--prop8" ), "\"val8\"", "Works with double quotes" ); + // Support: Safari <=9.1 - 18.1+ + // Safari converts single quotes to double ones. + if ( !/\bapplewebkit\/605\.1\.15\b/i.test( navigator.userAgent ) ) { assert.equal( $elem.css( "--prop9" ), "'val9'", "Works with single quotes" ); + } else { + assert.equal( $elem.css( "--prop9" ).replace( /"/g, "'" ), "'val9'", + "Works with single quotes, but they may be changed to double ones" ); } assert.equal( $elem.css( "--prop10" ), "val10", "Multiple preceding and following escaped unicode whitespace trimmed" ); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 6b0c9c798..93cdb3d82 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -345,29 +345,6 @@ QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/out $divNormal.remove(); } ); -QUnit.test( "getting dimensions shouldn't modify runtimeStyle see trac-9233", function( assert ) { - assert.expect( 1 ); - - var $div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ), - div = $div.get( 0 ), - runtimeStyle = div.runtimeStyle; - - if ( runtimeStyle ) { - div.runtimeStyle.marginLeft = "12em"; - div.runtimeStyle.left = "11em"; - } - - $div.outerWidth( true ); - - if ( runtimeStyle ) { - assert.equal( div.runtimeStyle.left, "11em", "getting dimensions modifies runtimeStyle, see trac-9233" ); - } else { - assert.ok( true, "this browser doesn't support runtimeStyle, see trac-9233" ); - } - - $div.remove(); -} ); - QUnit.test( "table dimensions", function( assert ) { assert.expect( 2 ); diff --git a/test/unit/event.js b/test/unit/event.js index 89d48c420..474699105 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1438,7 +1438,7 @@ QUnit.test( "Submit event can be stopped (trac-11049)", function( assert ) { form.remove(); } ); -// Support: iOS <=7 - 12+ +// Support: iOS <=7 - 18+ // iOS has the window.onbeforeunload field but doesn't support the beforeunload // handler making it impossible to feature-detect the support. QUnit[ /(ipad|iphone|ipod)/i.test( navigator.userAgent ) ? "skip" : "test" ]( diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 8300b4b9c..f4941b890 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -3020,8 +3020,7 @@ QUnit.test( "Sanitized HTML doesn't get unsanitized", function( assert ) { var container, counter = 0, - oldIos = /iphone os (?:8|9|10|11|12)_/i.test( navigator.userAgent ), - assertCount = oldIos ? 12 : 13, + assertCount = 13, done = assert.async( assertCount ); assert.expect( assertCount ); @@ -3065,12 +3064,7 @@ QUnit.test( "Sanitized HTML doesn't get unsanitized", function( assert ) { test( "<option><style></option></select><img src=url404 onerror=xss(11)></style>" ); - // Support: iOS 8 - 12 only. - // Old iOS parses `<noembed>` tags differently, executing this code. This is no - // different to native behavior on that OS, though, so just accept it. - if ( !oldIos ) { - test( "<noembed><noembed/><img src=url404 onerror=xss(12)>" ); - } + test( "<noembed><noembed/><img src=url404 onerror=xss(12)>" ); } ); QUnit.test( "Works with invalid attempts to close the table wrapper", function( assert ) { diff --git a/test/unit/offset.js b/test/unit/offset.js index 5cece84f4..bf16f7ddb 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -752,25 +752,15 @@ QUnit.test( "iframe scrollTop/Left (see gh-1945)", function( assert ) { var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument; - // Support: iOS <=8 - 12+ - // Mobile Safari resizes the iframe by its content meaning it's not possible to scroll - // the iframe but only its parent element. - if ( /iphone os|ipad/i.test( navigator.userAgent ) ) { - assert.equal( true, true, "Can't scroll iframes in this environment" ); - assert.equal( true, true, "Can't scroll iframes in this environment" ); + // Tests scrollTop/Left with iframes + jQuery( "#iframe" ).css( "width", "50px" ).css( "height", "50px" ); + ifDoc.write( "<div style='width: 1000px; height: 1000px;'></div>" ); - } else { + jQuery( ifDoc ).scrollTop( 200 ); + jQuery( ifDoc ).scrollLeft( 500 ); - // Tests scrollTop/Left with iframes - jQuery( "#iframe" ).css( "width", "50px" ).css( "height", "50px" ); - ifDoc.write( "<div style='width: 1000px; height: 1000px;'></div>" ); - - jQuery( ifDoc ).scrollTop( 200 ); - jQuery( ifDoc ).scrollLeft( 500 ); - - assert.equal( jQuery( ifDoc ).scrollTop(), 200, "$($('#iframe')[0].contentDocument).scrollTop()" ); - assert.equal( jQuery( ifDoc ).scrollLeft(), 500, "$($('#iframe')[0].contentDocument).scrollLeft()" ); - } + assert.equal( jQuery( ifDoc ).scrollTop(), 200, "$($('#iframe')[0].contentDocument).scrollTop()" ); + assert.equal( jQuery( ifDoc ).scrollLeft(), 500, "$($('#iframe')[0].contentDocument).scrollLeft()" ); } ); } )(); diff --git a/test/unit/selector.js b/test/unit/selector.js index 5fecfae94..062bad02b 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -858,7 +858,7 @@ QUnit.test( "pseudo - nth-child", function( assert ) { ); } else { - // Support: Chrome 75+, Firefox 67+ + // Support: Chrome 75 - 133+, Firefox 67 - 135+ // Some browsers mark disconnected elements as matching `:nth-child(n)` // so let's skip the test. assert.ok( "skip", "disconnected elements match ':nth-child(n)' in Chrome/Firefox" ); @@ -912,7 +912,7 @@ QUnit.test( "pseudo - nth-last-child", function( assert ) { ); } else { - // Support: Chrome 75+, Firefox 67+ + // Support: Chrome 75 - 133+, Firefox 67 - 135+ // Some browsers mark disconnected elements as matching `:nth-last-child(n)` // so let's skip the test. assert.ok( "skip", "disconnected elements match ':nth-last-child(n)' in Chrome/Firefox" ); @@ -954,7 +954,7 @@ QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "pseudo - has", function( asse "div:has(div:has(div:not([id])))", [ "moretests", "t2037", "fx-test-group", "fx-queue" ] ); - // Support: Safari 15.4+, Chrome 105+ + // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only // `qSA` in Safari/Chrome throws for `:has()` with only unsupported arguments // but if you add a supported arg to the list, it will run and just potentially // return no results. Make sure this is accounted for. (gh-5098) diff --git a/test/unit/support.js b/test/unit/support.js index bf3f4d26d..0961f3183 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -84,18 +84,10 @@ testIframe( cssHas: true, reliableTrDimensions: false }, - chrome_111: { - cssHas: false, - reliableTrDimensions: true - }, chrome: { cssHas: true, reliableTrDimensions: true }, - safari_16_3: { - cssHas: false, - reliableTrDimensions: true - }, safari: { cssHas: true, reliableTrDimensions: true @@ -104,11 +96,7 @@ testIframe( cssHas: true, reliableTrDimensions: false }, - ios_14_15_3: { - cssHas: true, - reliableTrDimensions: true - }, - ios_15_4_16_3: { + ios_16_3: { cssHas: false, reliableTrDimensions: true }, @@ -127,22 +115,16 @@ testIframe( if ( document.documentMode ) { expected = expectedMap.ie_11; - } else if ( /\b(?:headless)?chrome\/(?:10\d|11[01])\b/i.test( userAgent ) ) { - expected = expectedMap.chrome_111; } else if ( /\b(?:headless)?chrome\//i.test( userAgent ) ) { // Catches Edge, Chrome on Android & Opera as well. expected = expectedMap.chrome; } else if ( /\bfirefox\//i.test( userAgent ) ) { expected = expectedMap.firefox; - } else if ( /\biphone os (?:14_|15_[0123])/i.test( userAgent ) ) { - expected = expectedMap.ios_14_15_3; - } else if ( /\biphone os (?:15_|16_[0123])/i.test( userAgent ) ) { - expected = expectedMap.ios_15_4_16_3; + } else if ( /\biphone os 16_[0123]/i.test( userAgent ) ) { + expected = expectedMap.ios_16_3; } else if ( /\b(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) { expected = expectedMap.ios; - } else if ( /\bversion\/(?:15|16\.[0123])(?:\.\d+)* safari/i.test( userAgent ) ) { - expected = expectedMap.safari_16_3; } else if ( /\bversion\/\d+(?:\.\d+)+ safari/i.test( userAgent ) ) { expected = expectedMap.safari; } |