| <!DOCTYPE html> |
| <title>Node.moveBefore should not preserve CSS transition state when crossing shadow boundaries</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| |
| <body> |
| <section id="old-parent"> |
| <div id="item"></div> |
| </section> |
| <div id="shadow-container"> |
| <template shadowrootmode="open"> |
| <style> |
| #item { |
| width: 100px; |
| height: 100px; |
| background: green; |
| transition: left 10s; |
| position: absolute; |
| left: 0; |
| } |
| |
| section { |
| position: relative; |
| } |
| |
| body { |
| margin-left: 0; |
| } |
| </style> |
| <section id="new-parent"> |
| </section> |
| </template> |
| </div> |
| <style> |
| #item { |
| width: 100px; |
| height: 100px; |
| background: green; |
| transition: left 10s; |
| position: absolute; |
| left: 0; |
| } |
| |
| section { |
| position: relative; |
| } |
| |
| body { |
| margin-left: 0; |
| } |
| </style> |
| <script> |
| promise_test(async t => { |
| const item = document.querySelector("#item"); |
| assert_equals(item.getBoundingClientRect().x, 0); |
| item.style.left = "400px"; |
| await new Promise(resolve => item.addEventListener("transitionstart", resolve)); |
| const shadowContainer = document.querySelector("#shadow-container"); |
| shadowContainer.shadowRoot.querySelector("#new-parent").moveBefore(item, null); |
| await new Promise(resolve => requestAnimationFrame(() => resolve())); |
| assert_less_than(item.getBoundingClientRect().x, 400); |
| }, "Moving an element with a transition across shadow boundaries preserves the transition"); |
| </script> |
| </body> |