🌐 AI搜索 & 代理 主页
Skip to content

Commit 3527a38

Browse files
authored
Core: Remove IE-specific support tests, rely on document.documentMode
Also, update some tests to IE-sniff when deciding whether to skip a test. Fixes gh-4386 Closes gh-4387
1 parent ccbd6b9 commit 3527a38

27 files changed

+293
-465
lines changed

src/ajax.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ jQuery.extend( {
458458
if ( !responseHeaders ) {
459459
responseHeaders = {};
460460
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
461+
462+
// Support: IE 11+
463+
// `getResponseHeader( key )` in IE doesn't combine all header
464+
// values for the provided key into a single result with values
465+
// joined by commas as other browsers do. Instead, it returns
466+
// them on separate lines.
461467
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
462468
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
463469
.concat( match[ 2 ] );

src/attributes/attr.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ define( [
22
"../core",
33
"../core/access",
44
"../core/nodeName",
5-
"./support",
65
"../var/rnothtmlwhite",
6+
"../var/isIE",
77
"../selector"
8-
], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
8+
], function( jQuery, access, nodeName, rnothtmlwhite, isIE ) {
99

1010
"use strict";
1111

@@ -74,8 +74,10 @@ jQuery.extend( {
7474
attrHooks: {
7575
type: {
7676
set: function( elem, value ) {
77-
if ( !support.radioValue && value === "radio" &&
78-
nodeName( elem, "input" ) ) {
77+
78+
// Support: IE <=11+
79+
// An input loses its value after becoming a radio
80+
if ( isIE && value === "radio" && nodeName( elem, "input" ) ) {
7981
var val = elem.value;
8082
elem.setAttribute( "type", value );
8183
if ( val ) {

src/attributes/prop.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
define( [
22
"../core",
33
"../core/access",
4-
"./support",
4+
"../var/isIE",
55
"../selector"
6-
], function( jQuery, access, support ) {
6+
], function( jQuery, access, isIE ) {
77

88
"use strict";
99

@@ -90,14 +90,11 @@ jQuery.extend( {
9090
} );
9191

9292
// Support: IE <=11+
93-
// Accessing the selectedIndex property
94-
// forces the browser to respect setting selected
95-
// on the option
96-
// The getter ensures a default option is selected
97-
// when in an optgroup
98-
// eslint rule "no-unused-expressions" is disabled for this code
99-
// since it considers such accessions noop
100-
if ( !support.optSelected ) {
93+
// Accessing the selectedIndex property forces the browser to respect
94+
// setting selected on the option. The getter ensures a default option
95+
// is selected when in an optgroup. ESLint rule "no-unused-expressions"
96+
// is disabled for this code since it considers such accessions noop.
97+
if ( isIE ) {
10198
jQuery.propHooks.selected = {
10299
get: function( elem ) {
103100

src/attributes/support.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/css.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ define( [
22
"./core",
33
"./core/access",
44
"./var/rcssNum",
5+
"./var/isIE",
56
"./css/var/rnumnonpx",
67
"./css/var/cssExpand",
78
"./css/isAutoPx",
@@ -10,14 +11,13 @@ define( [
1011
"./css/var/swap",
1112
"./css/curCSS",
1213
"./css/adjustCSS",
13-
"./css/support",
1414
"./css/finalPropName",
1515

1616
"./core/init",
1717
"./core/ready",
1818
"./selector" // contains
19-
], function( jQuery, access, rcssNum, rnumnonpx, cssExpand, isAutoPx, cssCamelCase,
20-
getStyles, swap, curCSS, adjustCSS, support, finalPropName ) {
19+
], function( jQuery, access, rcssNum, isIE, rnumnonpx, cssExpand, isAutoPx,
20+
cssCamelCase, getStyles, swap, curCSS, adjustCSS, finalPropName ) {
2121

2222
"use strict";
2323

@@ -121,7 +121,7 @@ function getWidthOrHeight( elem, dimension, extra ) {
121121

122122
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
123123
// Fake content-box until we know it's needed to know the true value.
124-
boxSizingNeeded = !support.boxSizingReliable() || extra,
124+
boxSizingNeeded = isIE || extra,
125125
isBorderBox = boxSizingNeeded &&
126126
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
127127
valueIsBorderBox = isBorderBox,
@@ -140,11 +140,12 @@ function getWidthOrHeight( elem, dimension, extra ) {
140140

141141
// Fall back to offsetWidth/offsetHeight when value is "auto"
142142
// This happens for inline elements with no explicit setting (gh-3571)
143+
//
143144
// Support: IE 9 - 11+
144145
// Also use offsetWidth/offsetHeight for when box sizing is unreliable
145146
// We use getClientRects() to check for hidden/disconnected.
146147
// In those cases, the computed value can be trusted to be border-box
147-
if ( ( !support.boxSizingReliable() && isBorderBox || val === "auto" ) &&
148+
if ( ( isIE && isBorderBox || val === "auto" ) &&
148149
elem.getClientRects().length ) {
149150

150151
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
@@ -239,8 +240,9 @@ jQuery.extend( {
239240
value += ret && ret[ 3 ] || ( isAutoPx( origName ) ? "px" : "" );
240241
}
241242

242-
// background-* props affect original clone's values
243-
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
243+
// Support: IE <=9 - 11+
244+
// background-* props of a cloned element affect the source element (#8908)
245+
if ( isIE && value === "" && name.indexOf( "background" ) === 0 ) {
244246
style[ name ] = "inherit";
245247
}
246248

src/css/support.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/manipulation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ define( [
22
"./core",
33
"./core/isAttached",
44
"./var/concat",
5+
"./var/isIE",
56
"./var/push",
67
"./var/rcheckableType",
78
"./core/access",
@@ -11,7 +12,6 @@ define( [
1112
"./manipulation/getAll",
1213
"./manipulation/setGlobalEval",
1314
"./manipulation/buildFragment",
14-
"./manipulation/support",
1515

1616
"./data/var/dataPriv",
1717
"./data/var/dataUser",
@@ -23,9 +23,9 @@ define( [
2323
"./traversing",
2424
"./selector",
2525
"./event"
26-
], function( jQuery, isAttached, concat, push, rcheckableType,
27-
access, rtagName, rscriptType,
28-
wrapMap, getAll, setGlobalEval, buildFragment, support,
26+
], function( jQuery, isAttached, concat, isIE, push,
27+
rcheckableType, access, rtagName, rscriptType,
28+
wrapMap, getAll, setGlobalEval, buildFragment,
2929
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
3030

3131
"use strict";
@@ -222,7 +222,7 @@ jQuery.extend( {
222222
inPage = isAttached( elem );
223223

224224
// Fix IE cloning issues
225-
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
225+
if ( isIE && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
226226
!jQuery.isXMLDoc( elem ) ) {
227227

228228
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
@@ -233,7 +233,7 @@ jQuery.extend( {
233233

234234
// Support: IE <=11+
235235
// IE fails to set the defaultValue to the correct value when
236-
// cloning other types of input fields
236+
// cloning textareas.
237237
if ( destElements[ i ].nodeName.toLowerCase() === "textarea" ) {
238238
destElements[ i ].defaultValue = srcElements[ i ].defaultValue;
239239
}

src/manipulation/support.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/var/isIE.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
define( [
2+
"./document"
3+
], function( document ) {
4+
"use strict";
5+
6+
return document.documentMode;
7+
} );

test/data/inner_nomodule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
QUnit.assert.ok( !QUnit.moduleTypeSupported, "evaluated: inner nomodule script with src" );
1+
QUnit.assert.ok( QUnit.isIE, "evaluated: inner nomodule script with src" );

0 commit comments

Comments
 (0)