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

Docs: Fix code blocks occasionally lacking white-space in Firefox #30036

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

mrxz
Copy link
Contributor

@mrxz mrxz commented Dec 4, 2024

Related issue: #30008

Description

Prettify strips white-space from code blocks unless they are preformatted. This is based on the element's computed style. While the page is loading, the iframe is hidden using display: none, which under Firefox means getComputedStyle returns empty results. Depending on load order and connection speed, this could cause prettify to incorrectly assume code blocks aren't preformatted.

This PR sets the currentStyle property on the code block elements before loading prettify.js. This triggers a code path that avoids getComputedStyle working around the issue. The code path is originally for old versions of IE.

This contribution is funded by Fern Solutions

@Mugen87 Mugen87 added this to the r172 milestone Dec 4, 2024
@Mugen87 Mugen87 merged commit dfab00f into mrdoob:dev Dec 4, 2024
3 checks passed
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