mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
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
This commit is contained in:
parent
ccbd6b9342
commit
3527a38405
@ -458,6 +458,12 @@ jQuery.extend( {
|
||||
if ( !responseHeaders ) {
|
||||
responseHeaders = {};
|
||||
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
|
||||
|
||||
// Support: IE 11+
|
||||
// `getResponseHeader( key )` in IE doesn't combine all header
|
||||
// values for the provided key into a single result with values
|
||||
// joined by commas as other browsers do. Instead, it returns
|
||||
// them on separate lines.
|
||||
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
|
||||
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
|
||||
.concat( match[ 2 ] );
|
||||
|
@ -2,10 +2,10 @@ define( [
|
||||
"../core",
|
||||
"../core/access",
|
||||
"../core/nodeName",
|
||||
"./support",
|
||||
"../var/rnothtmlwhite",
|
||||
"../var/isIE",
|
||||
"../selector"
|
||||
], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
|
||||
], function( jQuery, access, nodeName, rnothtmlwhite, isIE ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -74,8 +74,10 @@ jQuery.extend( {
|
||||
attrHooks: {
|
||||
type: {
|
||||
set: function( elem, value ) {
|
||||
if ( !support.radioValue && value === "radio" &&
|
||||
nodeName( elem, "input" ) ) {
|
||||
|
||||
// Support: IE <=11+
|
||||
// An input loses its value after becoming a radio
|
||||
if ( isIE && value === "radio" && nodeName( elem, "input" ) ) {
|
||||
var val = elem.value;
|
||||
elem.setAttribute( "type", value );
|
||||
if ( val ) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../core/access",
|
||||
"./support",
|
||||
"../var/isIE",
|
||||
"../selector"
|
||||
], function( jQuery, access, support ) {
|
||||
], function( jQuery, access, isIE ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -90,14 +90,11 @@ jQuery.extend( {
|
||||
} );
|
||||
|
||||
// Support: IE <=11+
|
||||
// Accessing the selectedIndex property
|
||||
// forces the browser to respect setting selected
|
||||
// on the option
|
||||
// The getter ensures a default option is selected
|
||||
// when in an optgroup
|
||||
// eslint rule "no-unused-expressions" is disabled for this code
|
||||
// since it considers such accessions noop
|
||||
if ( !support.optSelected ) {
|
||||
// Accessing the selectedIndex property forces the browser to respect
|
||||
// setting selected on the option. The getter ensures a default option
|
||||
// is selected when in an optgroup. ESLint rule "no-unused-expressions"
|
||||
// is disabled for this code since it considers such accessions noop.
|
||||
if ( isIE ) {
|
||||
jQuery.propHooks.selected = {
|
||||
get: function( elem ) {
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
define( [
|
||||
"../var/document",
|
||||
"../var/support"
|
||||
], function( document, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
var input = document.createElement( "input" ),
|
||||
select = document.createElement( "select" ),
|
||||
opt = select.appendChild( document.createElement( "option" ) );
|
||||
|
||||
input.type = "checkbox";
|
||||
|
||||
// Support: IE <=11+
|
||||
// Must access selectedIndex to make default options select
|
||||
support.optSelected = opt.selected;
|
||||
|
||||
// Support: IE <=11+
|
||||
// An input loses its value after becoming a radio
|
||||
input = document.createElement( "input" );
|
||||
input.value = "t";
|
||||
input.type = "radio";
|
||||
support.radioValue = input.value === "t";
|
||||
} )();
|
||||
|
||||
return support;
|
||||
|
||||
} );
|
16
src/css.js
16
src/css.js
@ -2,6 +2,7 @@ define( [
|
||||
"./core",
|
||||
"./core/access",
|
||||
"./var/rcssNum",
|
||||
"./var/isIE",
|
||||
"./css/var/rnumnonpx",
|
||||
"./css/var/cssExpand",
|
||||
"./css/isAutoPx",
|
||||
@ -10,14 +11,13 @@ define( [
|
||||
"./css/var/swap",
|
||||
"./css/curCSS",
|
||||
"./css/adjustCSS",
|
||||
"./css/support",
|
||||
"./css/finalPropName",
|
||||
|
||||
"./core/init",
|
||||
"./core/ready",
|
||||
"./selector" // contains
|
||||
], function( jQuery, access, rcssNum, rnumnonpx, cssExpand, isAutoPx, cssCamelCase,
|
||||
getStyles, swap, curCSS, adjustCSS, support, finalPropName ) {
|
||||
], function( jQuery, access, rcssNum, isIE, rnumnonpx, cssExpand, isAutoPx,
|
||||
cssCamelCase, getStyles, swap, curCSS, adjustCSS, finalPropName ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -121,7 +121,7 @@ function getWidthOrHeight( elem, dimension, extra ) {
|
||||
|
||||
// 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,
|
||||
boxSizingNeeded = isIE || extra,
|
||||
isBorderBox = boxSizingNeeded &&
|
||||
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
||||
valueIsBorderBox = isBorderBox,
|
||||
@ -140,11 +140,12 @@ function getWidthOrHeight( elem, dimension, extra ) {
|
||||
|
||||
// Fall back to offsetWidth/offsetHeight when value is "auto"
|
||||
// This happens for inline elements with no explicit setting (gh-3571)
|
||||
//
|
||||
// Support: IE 9 - 11+
|
||||
// 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" ) &&
|
||||
if ( ( isIE && isBorderBox || val === "auto" ) &&
|
||||
elem.getClientRects().length ) {
|
||||
|
||||
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
||||
@ -239,8 +240,9 @@ jQuery.extend( {
|
||||
value += ret && ret[ 3 ] || ( isAutoPx( origName ) ? "px" : "" );
|
||||
}
|
||||
|
||||
// background-* props affect original clone's values
|
||||
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
|
||||
// Support: IE <=9 - 11+
|
||||
// background-* props of a cloned element affect the source element (#8908)
|
||||
if ( isIE && value === "" && name.indexOf( "background" ) === 0 ) {
|
||||
style[ name ] = "inherit";
|
||||
}
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/document",
|
||||
"../var/documentElement",
|
||||
"../var/support"
|
||||
], function( jQuery, document, documentElement, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
|
||||
var boxSizingReliableVal,
|
||||
container = document.createElement( "div" ),
|
||||
div = document.createElement( "div" );
|
||||
|
||||
// Finish early in limited (non-browser) environments
|
||||
if ( !div.style ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Support: IE <=9 - 11+
|
||||
// Style of cloned element affects source element cloned (#8908)
|
||||
div.style.backgroundClip = "content-box";
|
||||
div.cloneNode( true ).style.backgroundClip = "";
|
||||
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
||||
|
||||
jQuery.extend( support, {
|
||||
boxSizingReliable: function() {
|
||||
|
||||
// This is a singleton, we need to execute it only once
|
||||
if ( div ) {
|
||||
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
|
||||
"margin-top:1px;padding:0;border:0";
|
||||
div.style.cssText =
|
||||
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
|
||||
"margin:auto;border:1px;padding:1px;" +
|
||||
"width:60%;top:1%";
|
||||
documentElement.appendChild( container ).appendChild( div );
|
||||
|
||||
var divStyle = window.getComputedStyle( div );
|
||||
|
||||
// Support: IE 9 - 11+
|
||||
// Detect misreporting of content dimensions for box-sizing:border-box elements
|
||||
boxSizingReliableVal = Math.round( parseFloat( divStyle.width ) ) === 36;
|
||||
|
||||
documentElement.removeChild( container );
|
||||
|
||||
// Nullify the div so it wouldn't be stored in the memory and
|
||||
// it will also be a sign that checks already performed
|
||||
div = null;
|
||||
}
|
||||
|
||||
return boxSizingReliableVal;
|
||||
}
|
||||
} );
|
||||
} )();
|
||||
|
||||
return support;
|
||||
|
||||
} );
|
@ -2,6 +2,7 @@ define( [
|
||||
"./core",
|
||||
"./core/isAttached",
|
||||
"./var/concat",
|
||||
"./var/isIE",
|
||||
"./var/push",
|
||||
"./var/rcheckableType",
|
||||
"./core/access",
|
||||
@ -11,7 +12,6 @@ define( [
|
||||
"./manipulation/getAll",
|
||||
"./manipulation/setGlobalEval",
|
||||
"./manipulation/buildFragment",
|
||||
"./manipulation/support",
|
||||
|
||||
"./data/var/dataPriv",
|
||||
"./data/var/dataUser",
|
||||
@ -23,9 +23,9 @@ define( [
|
||||
"./traversing",
|
||||
"./selector",
|
||||
"./event"
|
||||
], function( jQuery, isAttached, concat, push, rcheckableType,
|
||||
access, rtagName, rscriptType,
|
||||
wrapMap, getAll, setGlobalEval, buildFragment, support,
|
||||
], function( jQuery, isAttached, concat, isIE, push,
|
||||
rcheckableType, access, rtagName, rscriptType,
|
||||
wrapMap, getAll, setGlobalEval, buildFragment,
|
||||
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
|
||||
|
||||
"use strict";
|
||||
@ -222,7 +222,7 @@ jQuery.extend( {
|
||||
inPage = isAttached( elem );
|
||||
|
||||
// Fix IE cloning issues
|
||||
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
|
||||
if ( isIE && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
|
||||
!jQuery.isXMLDoc( elem ) ) {
|
||||
|
||||
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
|
||||
@ -233,7 +233,7 @@ jQuery.extend( {
|
||||
|
||||
// Support: IE <=11+
|
||||
// IE fails to set the defaultValue to the correct value when
|
||||
// cloning other types of input fields
|
||||
// cloning textareas.
|
||||
if ( destElements[ i ].nodeName.toLowerCase() === "textarea" ) {
|
||||
destElements[ i ].defaultValue = srcElements[ i ].defaultValue;
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
define( [
|
||||
"../var/document",
|
||||
"../var/support"
|
||||
], function( document, support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
( function() {
|
||||
var fragment = document.createDocumentFragment(),
|
||||
div = fragment.appendChild( document.createElement( "div" ) ),
|
||||
input = document.createElement( "input" );
|
||||
|
||||
// Support: Windows Web Apps (WWA)
|
||||
// `name` and `type` must use .setAttribute for WWA (#14901)
|
||||
input.setAttribute( "type", "radio" );
|
||||
input.setAttribute( "checked", "checked" );
|
||||
|
||||
div.appendChild( input );
|
||||
|
||||
// Support: IE <=11+
|
||||
// Make sure textarea (and checkbox) defaultValue is properly cloned
|
||||
div.innerHTML = "<textarea>x</textarea>";
|
||||
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
|
||||
} )();
|
||||
|
||||
return support;
|
||||
|
||||
} );
|
7
src/var/isIE.js
Normal file
7
src/var/isIE.js
Normal file
@ -0,0 +1,7 @@
|
||||
define( [
|
||||
"./document"
|
||||
], function( document ) {
|
||||
"use strict";
|
||||
|
||||
return document.documentMode;
|
||||
} );
|
@ -1 +1 @@
|
||||
QUnit.assert.ok( !QUnit.moduleTypeSupported, "evaluated: inner nomodule script with src" );
|
||||
QUnit.assert.ok( QUnit.isIE, "evaluated: inner nomodule script with src" );
|
||||
|
@ -1 +1 @@
|
||||
QUnit.assert.ok( !QUnit.moduleTypeSupported, "evaluated: nomodule script with src" );
|
||||
QUnit.assert.ok( QUnit.isIE, "evaluated: nomodule script with src" );
|
||||
|
@ -4,6 +4,9 @@
|
||||
// jsdom implements a throwing `window.scrollTo`.
|
||||
QUnit.config.scrolltop = false;
|
||||
|
||||
QUnit.isIE = false;
|
||||
QUnit.testUnlessIE = QUnit.test;
|
||||
|
||||
const FILEPATH = "/test/data/testinit-jsdom.js";
|
||||
const activeScript = document.currentScript;
|
||||
const parentUrl = activeScript && activeScript.src ?
|
||||
|
@ -256,14 +256,11 @@ if ( !window.__karma__ ) {
|
||||
QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
|
||||
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
|
||||
|
||||
// Async test for module script type support
|
||||
function moduleTypeSupported() {
|
||||
var script = document.createElement( "script" );
|
||||
script.type = "module";
|
||||
script.text = "QUnit.moduleTypeSupported = true";
|
||||
document.head.appendChild( script ).parentNode.removeChild( script );
|
||||
}
|
||||
moduleTypeSupported();
|
||||
// Support: IE 11+
|
||||
// A variable to make it easier to skip specific tests in IE, mostly
|
||||
// testing integrations with newer Web features not supported by it.
|
||||
QUnit.isIE = !!window.document.documentMode;
|
||||
QUnit.testUnlessIE = QUnit.isIE ? QUnit.skip : QUnit.test;
|
||||
|
||||
this.loadTests = function() {
|
||||
|
||||
|
@ -138,7 +138,7 @@ var mocks = {
|
||||
"constructor": "prototype collision (constructor)"
|
||||
} );
|
||||
req.query.keys.split( "|" ).forEach( function( key ) {
|
||||
if ( req.headers[ key.toLowerCase() ] ) {
|
||||
if ( key.toLowerCase() in req.headers ) {
|
||||
resp.write( key + ": " + req.headers[ key.toLowerCase() ] + "\n" );
|
||||
}
|
||||
} );
|
||||
|
@ -260,7 +260,7 @@ QUnit.module( "ajax", {
|
||||
} );
|
||||
},
|
||||
url: url( "mock.php?action=headers&keys=siMPle|SometHing-elsE|OthEr|Nullable|undefined|Empty|ajax-send" ),
|
||||
headers: {
|
||||
headers: supportjQuery.extend( {
|
||||
"siMPle": "value",
|
||||
"SometHing-elsE": "other value",
|
||||
"OthEr": "something else",
|
||||
@ -268,11 +268,12 @@ QUnit.module( "ajax", {
|
||||
"undefined": undefined
|
||||
|
||||
// Support: IE 9 - 11+, Edge 12 - 14 only
|
||||
// Not all browsers allow empty-string headers
|
||||
//"Empty": ""
|
||||
},
|
||||
// IE can receive empty headers but not send them.
|
||||
}, QUnit.isIE ? {} : {
|
||||
"Empty": ""
|
||||
} ),
|
||||
success: function( data, _, xhr ) {
|
||||
var i, emptyHeader,
|
||||
var i,
|
||||
requestHeaders = jQuery.extend( this.headers, {
|
||||
"ajax-send": "test"
|
||||
} ),
|
||||
@ -285,13 +286,7 @@ QUnit.module( "ajax", {
|
||||
assert.strictEqual( data, tmp, "Headers were sent" );
|
||||
assert.strictEqual( xhr.getResponseHeader( "Sample-Header" ), "Hello World", "Sample header received" );
|
||||
assert.ok( data.indexOf( "undefined" ) < 0, "Undefined header value was not sent" );
|
||||
|
||||
emptyHeader = xhr.getResponseHeader( "Empty-Header" );
|
||||
if ( emptyHeader === null ) {
|
||||
assert.ok( true, "Firefox doesn't support empty headers" );
|
||||
} else {
|
||||
assert.strictEqual( emptyHeader, "", "Empty header received" );
|
||||
}
|
||||
assert.strictEqual( xhr.getResponseHeader( "Empty-Header" ), "", "Empty header received" );
|
||||
assert.strictEqual( xhr.getResponseHeader( "Sample-Header2" ), "Hello World 2", "Second sample header received" );
|
||||
assert.strictEqual( xhr.getResponseHeader( "List-Header" ), "Item 1, Item 2", "List header received" );
|
||||
assert.strictEqual( xhr.getResponseHeader( "constructor" ), "prototype collision (constructor)", "constructor header received" );
|
||||
|
@ -989,29 +989,37 @@ QUnit.test( "val() with non-matching values on dropdown list", function( assert
|
||||
select6.remove();
|
||||
} );
|
||||
|
||||
if ( "value" in document.createElement( "meter" ) &&
|
||||
"value" in document.createElement( "progress" ) ) {
|
||||
QUnit.test( "val() respects numbers without exception (Bug #9319) - progress",
|
||||
function( assert ) {
|
||||
|
||||
QUnit.test( "val() respects numbers without exception (Bug #9319)", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
assert.expect( 4 );
|
||||
|
||||
var $meter = jQuery( "<meter min='0' max='10' value='5.6'></meter>" ),
|
||||
$progress = jQuery( "<progress max='10' value='1.5'></progress>" );
|
||||
var $progress = jQuery( "<progress max='10' value='1.5'></progress>" );
|
||||
|
||||
try {
|
||||
assert.equal( typeof $meter.val(), "number", "meter, returns a number and does not throw exception" );
|
||||
assert.equal( $meter.val(), $meter[ 0 ].value, "meter, api matches host and does not throw exception" );
|
||||
|
||||
assert.equal( typeof $progress.val(), "number", "progress, returns a number and does not throw exception" );
|
||||
assert.equal( $progress.val(), $progress[ 0 ].value, "progress, api matches host and does not throw exception" );
|
||||
|
||||
} catch ( e ) {}
|
||||
|
||||
$meter.remove();
|
||||
$progress.remove();
|
||||
} );
|
||||
}
|
||||
|
||||
// IE doesn't support <meter>
|
||||
QUnit.testUnlessIE( "val() respects numbers without exception (Bug #9319) - meter",
|
||||
function( assert ) {
|
||||
|
||||
assert.expect( 2 );
|
||||
|
||||
var $meter = jQuery( "<meter min='0' max='10' value='5.6'></meter>" );
|
||||
|
||||
try {
|
||||
assert.equal( typeof $meter.val(), "number", "meter, returns a number and does not throw exception" );
|
||||
assert.equal( $meter.val(), $meter[ 0 ].value, "meter, api matches host and does not throw exception" );
|
||||
} catch ( e ) {}
|
||||
|
||||
$meter.remove();
|
||||
} );
|
||||
|
||||
var testVal = function( valueObj, assert ) {
|
||||
assert.expect( 9 );
|
||||
|
@ -329,7 +329,7 @@ QUnit.test( "isPlainObject", function( assert ) {
|
||||
}
|
||||
} );
|
||||
|
||||
QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)", function( assert ) {
|
||||
QUnit.testUnlessIE( "isPlainObject(Symbol)", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
assert.equal( jQuery.isPlainObject( Symbol() ), false, "Symbol" );
|
||||
@ -342,7 +342,7 @@ QUnit.test( "isPlainObject(localStorage)", function( assert ) {
|
||||
assert.equal( jQuery.isPlainObject( localStorage ), false );
|
||||
} );
|
||||
|
||||
QUnit[ "assign" in Object ? "test" : "skip" ]( "isPlainObject(Object.assign(...))",
|
||||
QUnit.testUnlessIE( "isPlainObject(Object.assign(...))",
|
||||
function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
|
@ -641,7 +641,11 @@ QUnit.test( "show/hide detached nodes", function( assert ) {
|
||||
span.remove();
|
||||
} );
|
||||
|
||||
QUnit[ document.body.getRootNode ? "test" : "skip" ]( "show/hide shadow child nodes", function( assert ) {
|
||||
// Support: IE 11+, Edge 12 - 18+
|
||||
// IE/Edge don't support Shadow DOM.
|
||||
QUnit[ document.body.getRootNode ? "test" : "skip" ](
|
||||
"show/hide shadow child nodes", function( assert ) {
|
||||
|
||||
assert.expect( 28 );
|
||||
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
|
||||
var shadowHost = document.querySelector( "#shadowHost" );
|
||||
@ -1210,11 +1214,10 @@ QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) {
|
||||
} );
|
||||
|
||||
|
||||
QUnit[
|
||||
jQuery( "<div/>" )[ 0 ].style.gridArea === "" ?
|
||||
"test" :
|
||||
"skip"
|
||||
]( "Do not append px to CSS Grid-related properties (gh-4007)", function( assert ) {
|
||||
// IE doesn't support the standard version of CSS Grid.
|
||||
QUnit.testUnlessIE( "Do not append px to CSS Grid-related properties (gh-4007)",
|
||||
function( assert ) {
|
||||
|
||||
assert.expect( 12 );
|
||||
|
||||
var prop, value, subProp, subValue, $div,
|
||||
@ -1365,22 +1368,7 @@ testIframe(
|
||||
}
|
||||
);
|
||||
|
||||
( function() {
|
||||
var supportsFractionalGBCR,
|
||||
qunitFixture = document.getElementById( "qunit-fixture" ),
|
||||
div = document.createElement( "div" );
|
||||
div.style.width = "3.3px";
|
||||
qunitFixture.appendChild( div );
|
||||
supportsFractionalGBCR = div.getBoundingClientRect().width.toFixed( 1 ) === "3.3";
|
||||
qunitFixture.removeChild( div );
|
||||
|
||||
QUnit.test( "css('width') and css('height') should return fractional values for nodes in the document", function( assert ) {
|
||||
if ( !supportsFractionalGBCR ) {
|
||||
assert.expect( 1 );
|
||||
assert.ok( true, "This browser doesn't support fractional values in getBoundingClientRect()" );
|
||||
return;
|
||||
}
|
||||
|
||||
QUnit.testUnlessIE( "css('width') and css('height') should return fractional values for nodes in the document", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var el = jQuery( "<div class='test-div'></div>" ).appendTo( "#qunit-fixture" );
|
||||
@ -1392,13 +1380,7 @@ testIframe(
|
||||
"css('height') should return fractional values" );
|
||||
} );
|
||||
|
||||
QUnit.test( "css('width') and css('height') should return fractional values for disconnected nodes", function( assert ) {
|
||||
if ( !supportsFractionalGBCR ) {
|
||||
assert.expect( 1 );
|
||||
assert.ok( true, "This browser doesn't support fractional values in getBoundingClientRect()" );
|
||||
return;
|
||||
}
|
||||
|
||||
QUnit.testUnlessIE( "css('width') and css('height') should return fractional values for disconnected nodes", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var el = jQuery( "<div style='width: 33.3px; height: 88.8px;'></div>" );
|
||||
@ -1408,7 +1390,6 @@ testIframe(
|
||||
assert.equal( Number( el.css( "height" ).replace( /px$/, "" ) ).toFixed( 1 ), "88.8",
|
||||
"css('height') should return fractional values" );
|
||||
} );
|
||||
} )();
|
||||
|
||||
QUnit.test( "certain css values of 'normal' should be convertable to a number, see #8627", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
@ -1736,16 +1717,9 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
|
||||
|
||||
} )();
|
||||
|
||||
( function() {
|
||||
var supportsCssVars,
|
||||
elem = jQuery( "<div>" ).appendTo( document.body ),
|
||||
div = elem[ 0 ];
|
||||
// IE doesn't support CSS variables.
|
||||
QUnit.testUnlessIE( "css(--customProperty)", function( assert ) {
|
||||
|
||||
div.style.setProperty( "--prop", "value" );
|
||||
supportsCssVars = !!getComputedStyle( div ).getPropertyValue( "--prop" );
|
||||
elem.remove();
|
||||
|
||||
QUnit[ supportsCssVars ? "test" : "skip" ]( "css(--customProperty)", function( assert ) {
|
||||
jQuery( "#qunit-fixture" ).append(
|
||||
"<style>\n" +
|
||||
" .test__customProperties {\n" +
|
||||
@ -1804,7 +1778,9 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
|
||||
}
|
||||
} );
|
||||
|
||||
QUnit[ supportsCssVars ? "test" : "skip" ]( "Don't append px to CSS vars", function( assert ) {
|
||||
// IE doesn't support CSS variables.
|
||||
QUnit.testUnlessIE( "Don't append px to CSS vars", function( assert ) {
|
||||
|
||||
assert.expect( 3 );
|
||||
|
||||
var $div = jQuery( "<div>" ).appendTo( "#qunit-fixture" );
|
||||
@ -1818,12 +1794,10 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
|
||||
assert.equal( $div.css( "--line-height" ), "4", "--line-height: 4" );
|
||||
assert.equal( $div.css( "--lineHeight" ), "5", "--lineHeight: 5" );
|
||||
} );
|
||||
} )();
|
||||
|
||||
}
|
||||
|
||||
// Support: IE 11+
|
||||
if ( document.documentMode ) {
|
||||
// This test requires Grid to be *not supported* to work.
|
||||
if ( QUnit.isIE ) {
|
||||
// Make sure explicitly provided IE vendor prefix (`-ms-`) is not converted
|
||||
// to a non-working `Ms` prefix in JavaScript.
|
||||
QUnit.test( "IE vendor prefixes are not mangled", function( assert ) {
|
||||
@ -1836,3 +1810,5 @@ if ( document.documentMode ) {
|
||||
assert.strictEqual( div.css( "-ms-grid-row" ), "1", "IE vendor prefixing" );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -513,7 +513,6 @@ QUnit.test( ".removeData()", function( assert ) {
|
||||
assert.equal( div.data( "test.foo" ), undefined, "Make sure data is intact" );
|
||||
} );
|
||||
|
||||
if ( window.JSON && window.JSON.stringify ) {
|
||||
QUnit.test( "JSON serialization (#8108)", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
@ -522,7 +521,6 @@ if ( window.JSON && window.JSON.stringify ) {
|
||||
|
||||
assert.equal( JSON.stringify( obj ), "{\"foo\":\"bar\"}", "Expando is hidden from JSON.stringify" );
|
||||
} );
|
||||
}
|
||||
|
||||
QUnit.test( ".data should follow html5 specification regarding camel casing", function( assert ) {
|
||||
assert.expect( 12 );
|
||||
|
@ -543,8 +543,7 @@ QUnit.test( "jQuery.Deferred.then - spec compatibility", function( assert ) {
|
||||
} catch ( _ ) {}
|
||||
} );
|
||||
|
||||
QUnit[ typeof Symbol === "function" && Symbol.toStringTag ? "test" : "skip" ](
|
||||
"jQuery.Deferred.then - IsCallable determination (gh-3596)",
|
||||
QUnit.testUnlessIE( "jQuery.Deferred.then - IsCallable determination (gh-3596)",
|
||||
function( assert ) {
|
||||
|
||||
assert.expect( 1 );
|
||||
@ -560,8 +559,7 @@ QUnit[ typeof Symbol === "function" && Symbol.toStringTag ? "test" : "skip" ](
|
||||
defer.then( faker ).then( done );
|
||||
|
||||
defer.resolve();
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( "jQuery.Deferred.exceptionHook", function( assert ) {
|
||||
|
||||
|
@ -41,8 +41,7 @@ QUnit.test( "delegate/undelegate", function( assert ) {
|
||||
.remove();
|
||||
} );
|
||||
|
||||
if ( jQuery.fn.hover ) {
|
||||
QUnit.test( "hover() mouseenter mouseleave", function( assert ) {
|
||||
QUnit[ jQuery.fn.hover ? "test" : "skip" ]( "hover() mouseenter mouseleave", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
var times = 0,
|
||||
@ -60,10 +59,7 @@ if ( jQuery.fn.hover ) {
|
||||
.mouseenter().mouseleave();
|
||||
|
||||
assert.equal( times, 4, "hover handlers fired" );
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
QUnit[ jQuery.fn.click ? "test" : "skip" ]( "trigger() shortcuts", function( assert ) {
|
||||
assert.expect( 5 );
|
||||
|
@ -659,9 +659,9 @@ QUnit.test( "interaction with scrollbars (gh-3589)", function( assert ) {
|
||||
parent = jQuery( "<div/>" )
|
||||
.css( { position: "absolute", width: "1000px", height: "1000px" } )
|
||||
.appendTo( "#qunit-fixture" ),
|
||||
fraction = jQuery.support.boxSizingReliable() ?
|
||||
jQuery( "<div style='width:4.5px;'/>" ).appendTo( parent ).width() % 1 :
|
||||
0,
|
||||
|
||||
// Workarounds for IE kill fractional output here.
|
||||
fraction = document.documentMode ? 0 : 0.5,
|
||||
borderWidth = 1,
|
||||
padding = 2,
|
||||
size = 100 + fraction,
|
||||
|
2
test/unit/effects.js
vendored
2
test/unit/effects.js
vendored
@ -221,6 +221,8 @@ supportjQuery.each( hideOptions, function( type, setup ) {
|
||||
assert.expectJqData( this, $span, "olddisplay" );
|
||||
} );
|
||||
|
||||
// Support: IE 11+, Edge 12 - 18+
|
||||
// IE/Edge don't support Shadow DOM.
|
||||
QUnit[ document.body.getRootNode ? "test" : "skip" ](
|
||||
"Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
|
@ -445,8 +445,7 @@ QUnit.test( "append HTML5 sectioning elements (Bug #6485)", function( assert ) {
|
||||
assert.equal( aside.length, 1, "HTML5 elements do not collapse their children" );
|
||||
} );
|
||||
|
||||
if ( jQuery.css ) {
|
||||
QUnit.test( "HTML5 Elements inherit styles from style rules (Bug #10501)", function( assert ) {
|
||||
QUnit[ jQuery.fn.css ? "test" : "skip" ]( "HTML5 Elements inherit styles from style rules (Bug #10501)", function( assert ) {
|
||||
|
||||
assert.expect( 1 );
|
||||
|
||||
@ -456,7 +455,6 @@ if ( jQuery.css ) {
|
||||
// In IE, the missing background color will claim its value is "transparent"
|
||||
assert.notEqual( jQuery( "section" ).css( "background-color" ), "transparent", "HTML5 elements inherit styles" );
|
||||
} );
|
||||
}
|
||||
|
||||
QUnit.test( "html(String) with HTML5 (Bug #6485)", function( assert ) {
|
||||
|
||||
@ -1767,9 +1765,9 @@ QUnit.test( "html(Function)", function( assert ) {
|
||||
QUnit[
|
||||
// Support: Edge 16 - 18+
|
||||
// Edge sometimes doesn't execute module scripts so skip the test there.
|
||||
( QUnit.moduleTypeSupported && !/edge\//i.test( navigator.userAgent ) ) ?
|
||||
"test" :
|
||||
"skip"
|
||||
( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ?
|
||||
"skip" :
|
||||
"test"
|
||||
]( "html(script type module)", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
var done = assert.async(),
|
||||
@ -1794,18 +1792,17 @@ QUnit[
|
||||
|
||||
QUnit.test( "html(script nomodule)", function( assert ) {
|
||||
|
||||
// Support: IE 9 - 11+
|
||||
// `nomodule` scripts should be executed by legacy browsers only.
|
||||
assert.expect( QUnit.moduleTypeSupported ? 0 : 4 );
|
||||
assert.expect( QUnit.isIE ? 4 : 0 );
|
||||
var done = assert.async(),
|
||||
$fixture = jQuery( "#qunit-fixture" );
|
||||
|
||||
$fixture.html(
|
||||
[
|
||||
"<script nomodule>QUnit.assert.ok( !QUnit.moduleTypeSupported, 'evaluated: nomodule script' );</script>",
|
||||
"<script nomodule>QUnit.assert.ok( QUnit.isIE, 'evaluated: nomodule script' );</script>",
|
||||
"<script nomodule src='" + url( "nomodule.js" ) + "'></script>",
|
||||
"<div>",
|
||||
"<script nomodule>QUnit.assert.ok( !QUnit.moduleTypeSupported, 'evaluated: inner nomodule script' );</script>",
|
||||
"<script nomodule>QUnit.assert.ok( QUnit.isIE, 'evaluated: inner nomodule script' );</script>",
|
||||
"<script nomodule src='" + url( "inner_nomodule.js" ) + "'></script>",
|
||||
"</div>"
|
||||
].join( "" )
|
||||
|
@ -271,8 +271,7 @@ QUnit.test( ".promise(obj)", function( assert ) {
|
||||
assert.strictEqual( promise, obj, ".promise(type, obj) returns obj" );
|
||||
} );
|
||||
|
||||
if ( jQuery.fn.stop ) {
|
||||
QUnit.test( "delay() can be stopped", function( assert ) {
|
||||
QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "delay() can be stopped", function( assert ) {
|
||||
var done = assert.async();
|
||||
assert.expect( 3 );
|
||||
var storage = {};
|
||||
@ -309,7 +308,7 @@ if ( jQuery.fn.stop ) {
|
||||
}, 1500 );
|
||||
} );
|
||||
|
||||
QUnit.test( "queue stop hooks", function( assert ) {
|
||||
QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "queue stop hooks", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var done = assert.async();
|
||||
var foo = jQuery( "#foo" );
|
||||
@ -330,5 +329,3 @@ if ( jQuery.fn.stop ) {
|
||||
|
||||
foo.stop( false, true );
|
||||
} );
|
||||
|
||||
} // if ( jQuery.fn.stop )
|
||||
|
@ -58,48 +58,12 @@ testIframe(
|
||||
var expected,
|
||||
userAgent = window.navigator.userAgent,
|
||||
expectedMap = {
|
||||
edge: {
|
||||
boxSizingReliable: true,
|
||||
clearCloneStyle: true,
|
||||
noCloneChecked: true,
|
||||
optSelected: true,
|
||||
radioValue: true
|
||||
},
|
||||
ie_11: {
|
||||
boxSizingReliable: false,
|
||||
clearCloneStyle: false,
|
||||
noCloneChecked: false,
|
||||
optSelected: false,
|
||||
radioValue: false
|
||||
},
|
||||
chrome: {
|
||||
boxSizingReliable: true,
|
||||
clearCloneStyle: true,
|
||||
noCloneChecked: true,
|
||||
optSelected: true,
|
||||
radioValue: true
|
||||
},
|
||||
safari: {
|
||||
boxSizingReliable: true,
|
||||
clearCloneStyle: true,
|
||||
noCloneChecked: true,
|
||||
optSelected: true,
|
||||
radioValue: true
|
||||
},
|
||||
firefox: {
|
||||
boxSizingReliable: true,
|
||||
clearCloneStyle: true,
|
||||
noCloneChecked: true,
|
||||
optSelected: true,
|
||||
radioValue: true
|
||||
},
|
||||
ios: {
|
||||
boxSizingReliable: true,
|
||||
clearCloneStyle: true,
|
||||
noCloneChecked: true,
|
||||
optSelected: true,
|
||||
radioValue: true
|
||||
}
|
||||
edge: {},
|
||||
ie_11: {},
|
||||
chrome: {},
|
||||
safari: {},
|
||||
firefox: {},
|
||||
ios: {}
|
||||
};
|
||||
|
||||
if ( /edge\//i.test( userAgent ) ) {
|
||||
@ -140,8 +104,8 @@ testIframe(
|
||||
}
|
||||
} );
|
||||
|
||||
QUnit.test( "Verify most support tests are failing in one " +
|
||||
"of tested browsers", function( assert ) {
|
||||
QUnit.test( "Verify support tests are failing in one of tested browsers",
|
||||
function( assert ) {
|
||||
|
||||
var prop, browserKey, supportTestName,
|
||||
i = 0,
|
||||
|
@ -773,7 +773,7 @@ QUnit.test( "contents() for <template />", function( assert ) {
|
||||
assert.equal( contents.filter( "div" ).length, 3, "Count cloned elements from template" );
|
||||
} );
|
||||
|
||||
QUnit[ "content" in document.createElement( "template" ) ? "test" : "skip" ]( "contents() for <template /> remains inert", function( assert ) {
|
||||
QUnit.testUnlessIE( "contents() for <template /> remains inert", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
Globals.register( "testScript" );
|
||||
|
Loading…
Reference in New Issue
Block a user