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

Add feature detection for WebKit #50

Merged
merged 8 commits into from
Feb 10, 2023
Merged

Add feature detection for WebKit #50

merged 8 commits into from
Feb 10, 2023

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Feb 5, 2023

WebKit's layer-based SVG engine is the last piece to fix this long-standing bug. If it would be ready, Marpit and related tools finally can make polyfill-free.

I've added a feature detection of WebKit LBSE. If enabled LBSE, marpit-svg-polyfill will never apply even if used WebKit. (In Safari TP, a restart required after toggled LBSE)

yhatt added 2 commits February 4, 2023 20:37
Safari is working on the layer-based SVG engine. A polyfill must not
apply if the option was enabled.
@yhatt yhatt marked this pull request as ready for review February 5, 2023 17:42
Comment on lines +130 to +133
// Repaint viewport forcibly when initial observing, to clear buggy SVG debris
document.body.style['zoom'] = 1.0001
void document.body.offsetHeight
document.body.style['zoom'] = 1
Copy link
Member Author

Choose a reason for hiding this comment

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

If non-polyfilled SVG had been rendered before applying polyfills, WebKit sometime leaves SVG debris. An updated feature detection is asynchronous so we have to deal with debris.

This snippet triggers repaint in the whole of HTML contents to clear SVG debris in everywhere.

@yhatt yhatt merged commit a7ff40a into main Feb 10, 2023
@yhatt yhatt deleted the webkit-feature-detection branch February 10, 2023 10:39
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.

1 participant