@@ -29,30 +29,34 @@ test(() => {
2929 "name" : "ShadowRoot" ,
3030 "creator" : doc => doc . createElementNS ( "http://www.w3.org/1999/xhtml" , "div" ) . attachShadow ( { mode : "closed" } )
3131 }
32- ] . forEach ( dfTest => {
32+ ] . forEach ( ( { name , creator } ) => {
3333 test ( ( ) => {
3434 const doc = new Document ( ) ;
35- const df = dfTest . creator ( doc ) ;
35+ const df = creator ( doc ) ;
3636 const child = df . appendChild ( new Text ( 'hi' ) ) ;
3737 assert_equals ( df . ownerDocument , doc ) ;
3838
3939 document . body . appendChild ( df ) ;
4040 assert_equals ( df . childNodes . length , 0 ) ;
4141 assert_equals ( child . ownerDocument , document ) ;
42- assert_equals ( df . ownerDocument , doc ) ;
43- } , `appendChild() and ${ dfTest . name } ` ) ;
42+ if ( name === "ShadowRoot" ) {
43+ assert_equals ( df . ownerDocument , doc ) ;
44+ } else {
45+ assert_equals ( df . ownerDocument , document ) ;
46+ }
47+ } , `appendChild() and ${ name } ` ) ;
4448
4549 test ( ( ) => {
4650 const doc = new Document ( ) ;
47- const df = dfTest . creator ( doc ) ;
51+ const df = creator ( doc ) ;
4852 const child = df . appendChild ( new Text ( 'hi' ) ) ;
49- if ( dfTest . name === "ShadowRoot" ) {
53+ if ( name === "ShadowRoot" ) {
5054 assert_throws_dom ( "HierarchyRequestError" , ( ) => document . adoptNode ( df ) ) ;
5155 } else {
5256 document . adoptNode ( df ) ;
5357 assert_equals ( df . childNodes . length , 1 ) ;
5458 assert_equals ( child . ownerDocument , document ) ;
5559 assert_equals ( df . ownerDocument , document ) ;
5660 }
57- } , `adoptNode() and ${ dfTest . name } ` ) ;
61+ } , `adoptNode() and ${ name } ` ) ;
5862} ) ;
0 commit comments