diff --git a/testing/web-platform/tests/shadow-dom/declarative/clonable.window.js b/testing/web-platform/tests/shadow-dom/declarative/clonable.window.js deleted file mode 100644 index 316005ac8d77e..0000000000000 --- a/testing/web-platform/tests/shadow-dom/declarative/clonable.window.js +++ /dev/null @@ -1,120 +0,0 @@ -test -( -( -) -= -> -{ -const -div -= -document -. -createElement -( -" -div -" -) -; -const -root -= -div -. -attachShadow -( -{ -mode -: -" -open -" -clonable -: -true -} -) -; -root -. -appendChild -( -document -. -createElement -( -" -input -" -) -) -; -assert_true -( -root -. -clonable -" -clonable -attribute -" -) -; -const -cloned -= -div -. -cloneNode -( -true -) -; -assert_equals -( -cloned -. -shadowRoot -. -children -. -length -1 -" -children -count -" -) -; -assert_equals -( -cloned -. -shadowRoot -. -children -[ -0 -] -. -localName -" -input -" -" -children -content -" -) -; -} -" -attachShadow -with -clonable -: -true -" -) -; diff --git a/testing/web-platform/tests/shadow-dom/shadow-root-clonable.html b/testing/web-platform/tests/shadow-dom/shadow-root-clonable.html new file mode 100644 index 0000000000000..382be25665f00 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/shadow-root-clonable.html @@ -0,0 +1,522 @@ +< +! +DOCTYPE +html +> +< +title +> +Shadow +root +clonable +flag +< +/ +title +> +< +link +rel += +' +author +' +href += +' +mailto +: +krosylight +mozilla +. +com +' +> +< +link +rel += +' +author +' +href += +' +mailto +: +masonf +chromium +. +org +' +> +< +link +rel += +' +help +' +href += +' +https +: +/ +/ +dom +. +spec +. +whatwg +. +org +/ +# +shadowroot +- +clonable +' +> +< +script +src += +' +/ +resources +/ +testharness +. +js +' +> +< +/ +script +> +< +script +src += +' +/ +resources +/ +testharnessreport +. +js +' +> +< +/ +script +> +< +body +> +< +script +> +test +( +( +) += +> +{ +const +div += +document +. +createElement +( +" +div +" +) +; +const +root += +div +. +attachShadow +( +{ +mode +: +" +open +" +clonable +: +true +} +) +; +root +. +appendChild +( +document +. +createElement +( +" +input +" +) +) +; +assert_true +( +root +. +clonable +" +clonable +attribute +" +) +; +const +clone += +div +. +cloneNode +( +true +) +; +const +clonedRoot += +clone +. +shadowRoot +; +assert_true +( +clonedRoot +. +clonable +" +clone +gets +the +same +clonable +state +" +) +; +assert_equals +( +clonedRoot +. +children +. +length +1 +" +children +count +" +) +; +assert_equals +( +clonedRoot +. +children +[ +0 +] +. +localName +" +input +" +" +children +content +" +) +; +} +" +attachShadow +with +clonable +: +true +" +) +; +for +( +const +clonable +of +[ +false +undefined +] +) +{ +test +( +( +) += +> +{ +const +div += +document +. +createElement +( +" +div +" +) +; +const +root += +div +. +attachShadow +( +{ +mode +: +" +open +" +clonable +} +) +; +root +. +appendChild +( +document +. +createElement +( +" +input +" +) +) +; +assert_false +( +root +. +clonable +" +clonable +attribute +" +) +; +const +clone += +div +. +cloneNode +( +true +) +; +assert_true +( +! +clone +. +shadowRoot +" +shadow +should +not +be +cloned +" +) +; +} +attachShadow +with +clonable +: +{ +clonable +} +) +; +} +test +( +( +) += +> +{ +const +div += +document +. +createElement +( +" +div +" +) +; +div +. +setHTMLUnsafe +( +' +< +div +> +< +template +shadowrootmode += +open +> +< +input +> +< +/ +template +> +< +/ +div +> +' +) +; +const +root += +div +. +firstElementChild +. +shadowRoot +; +assert_true +( +! +! +root +) +; +assert_true +( +root +. +clonable +" +clonable +is +automatically +true +for +declarative +shadow +root +" +) +; +const +clone += +div +. +cloneNode +( +true +) +; +const +clonedRoot += +clone +. +firstElementChild +. +shadowRoot +; +assert_true +( +! +! +clonedRoot +) +; +assert_equals +( +clonedRoot +. +children +. +length +1 +" +children +count +" +) +; +assert_equals +( +clonedRoot +. +children +[ +0 +] +. +localName +" +input +" +" +children +content +" +) +; +} +" +declarative +shadow +roots +get +clonable +: +true +automatically +" +) +; +< +/ +script +>