},
composed = { composed: true };
+ // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
// Check attachment across shadow DOM boundaries when possible (gh-3504)
- if ( documentElement.attachShadow ) {
+ // Support: iOS 10.0-10.2 only
+ // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
+ // leading to errors. We need to check for `getRootNode`.
+ if ( documentElement.getRootNode ) {
isAttached = function( elem ) {
return jQuery.contains( elem.ownerDocument, elem ) ||
elem.getRootNode( composed ) === elem.ownerDocument;
span.remove();
} );
-QUnit[ document.body.attachShadow ? "test" : "skip" ]( "show/hide shadow child nodes", function( assert ) {
+QUnit[
+ document.body.attachShadow && 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" );
"cascade-hidden element in detached tree" );
} );
-QUnit[ jQuery.find.compile && jQuery.fn.toggle && document.body.attachShadow ? "test" : "skip" ]( "shadow toggle()", function( assert ) {
+QUnit[ jQuery.find.compile && jQuery.fn.toggle &&
+ document.body.attachShadow && document.body.getRootNode ?
+ "test" :
+ "skip"
+]( "shadow toggle()", function( assert ) {
assert.expect( 4 );
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
var shadowHost = document.querySelector( "#shadowHost" );
assert.expectJqData( this, $span, "olddisplay" );
} );
- QUnit[ document.body.attachShadow ? "test" : "skip" ](
- "Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
+ QUnit[
+ document.body.attachShadow && document.body.getRootNode ?
+ "test" :
+ "skip"
+ ]( "Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
assert.expect( 3 );
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );