chai-dom icon indicating copy to clipboard operation
chai-dom copied to clipboard

Fix `visible` to work with elements in the Shadow DOM

Open eKoopmans opened this issue 2 years ago • 2 comments

As a follow-up to #63 and #64, this applies the same shadow DOM fix for visible.

I have modified the check for both displayed and visible to restore backwards-compatibility: on older browsers that don't support .getRootNode, it'll fall back to the older check of document.body.contains(el).

I also modified the test from #64, which was returning false positives (passing both before and after the fix). The new test successfully passes with the fixes, and fails without the fixes.

eKoopmans avatar Sep 06 '23 21:09 eKoopmans

Looks good!

jpzwarte avatar Sep 07 '23 11:09 jpzwarte

@nathanboktae this will bring visible into parity with displayed - let me know if there's any changed you'd like.

eKoopmans avatar Sep 14 '23 14:09 eKoopmans