Closed jpzwarte closed 1 year ago
@nathanboktae Could you review this please?
This LGTM! The same broken check is present in visible
as well:
https://github.com/nathanboktae/chai-dom/blob/master/chai-dom.js#L365
Would be great to get a fix merged for both of these! The only potential issue is browser support, not sure if it's a concern (e.g. no IE support): https://caniuse.com/mdn-api_node_getrootnode
Thanks. This does cut off support for IE11, but that time has long come.
Cool, thanks for merging! Do you want me to put up a PR for visible
?
If you did want to maintain backwards compatibility btw, this is an option:
var el = flag(this, 'object'),
isAttached = el.getRootNode ? el.getRootNode({ composed: true }) === document : document.body.contains(el),
actual = isAttached ? window.getComputedStyle(el).display : el.style.display
Fixes #63