Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
fix: add check for style tag detached and then removed - sheet in the style tag is null in this case #2707
Hi, thanks for the great work and amazing lib.
We have a special use case of React and styled-components:
When un-mounting the app, what I found is the sheet property in <style> tag made by makeSpeedyTag() function is null, because when disconnectedCallback getting called, the style DOM node is already removed from DOM.
By checking the isConnected flag, we know whether the style element is detached or not.
I am not sure whether styled-components should consider this issue or not.
The jsdom version used by jest doesn't support shadow DOM yet.
So, even the tag is detached from DOM, this.sheet instance still exists.
Just added the unit tests and raised a pull request:
Not sure we still need it or not.