KonnorRogers / shadow-dom-testing-library

An extension of DOM-testing-library to provide hooks into the shadow dom
MIT License
98 stars 2 forks source link

`screen.debug()` modifies DOM (Schrödinger's DOM) #32

Closed CreativeTechGuy closed 2 years ago

CreativeTechGuy commented 2 years ago

I was experiencing a strange issue where if I had screen.debug() in my test, the following steps would behave differently. After some digging, I realized it was because the debug method actually modified the DOM. It appears to be from these lines where node is a reference to the actual DOM and an element is inserted.

Can the node be copied first so that the actual DOM isn't changed as a result of debugging?

KonnorRogers commented 2 years ago

DOH! Thanks! Yea a cloneNode should work here.