Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement sharing system to address Safari issues #88

Merged

Conversation

Lodin
Copy link
Collaborator

@Lodin Lodin commented Oct 6, 2021

Since we have a lot of Safari-related bugs caused by the broken Safari CSSStyleSheet API (#84, #87), I decided to get back the original sharing system used in 2.x.x versions of the polyfill. It uses textContent property of the HTMLStyleSheet and storage for the additional CSSStyleSheet methods (insertRule, etc.) The system should solve any Safari issues because polyfill doesn't interact with the CSSStyleSheet API anymore.

This PR returns that system. Along with the correct behavior, it also reduces the polyfill size to 1.82 kB according to size-limit. Regarding the performance: I did some benchmarks, and it looks like the two versions have almost similar numbers. The textContent version might be even slightly faster. So I don't expect any performance hit with this change.

@Lodin Lodin requested a review from calebdwilliams October 6, 2021 09:52
Copy link
Owner

@calebdwilliams calebdwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calebdwilliams
Copy link
Owner

@Lodin tested all of the known edge cases and this looks good to me. Is it ready for merge/release?

@Lodin
Copy link
Collaborator Author

Lodin commented Oct 12, 2021

@calebdwilliams, yes, it is ready

Copy link
Owner

@calebdwilliams calebdwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calebdwilliams calebdwilliams merged commit 4e03571 into calebdwilliams:main Oct 13, 2021
@calebdwilliams
Copy link
Owner

This fix is in 3.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants