react-ui-org/react-ui

Prism CSS does not load in Safari

adamkudrna opened this issue ยท 2 comments

Problem

404 on Prism CSS because of **/0/ in the URL.

Image

Image

Affected browsers

Safari 17/macOS

Chrome and Firefox work fine.

๐Ÿ‘‰ We have already run into a similar issue in Chrome recently where the CSS custom property was parsed incorrectly.

Prossible solution

Surround CSS URL with quotes:

--docoff-code-prism-css: 'https://unpkg.com/prismjs@1.29/themes/prism-twilight.min.css';

As it appears, strings in CSS custom properties should be quoted, otherwise they are considered CSS keywords and may not function as expected.

As it appears, strings in CSS custom properties should be quoted, otherwise they are considered CSS keywords and may not function as expected.

I don't think so: https://drafts.csswg.org/css-variables/#serializing-custom-props

Specifically:

Custom property names must be serialized as the exact code point sequence provided by the author, including not altering the case.

So I think this is the same bug as we had in Chrome. The closes thing I could find in Safari bug tracker are:

I think we have the following options:

  1. Set the value to https://unpkg.com/prismjs@1.29/themes/prism-twilight.min.css with no patch version specified
  • (+) Simple fix
  • (-) The CSS will load with a redirect => extra request
  1. Set the value to "https://unpkg.com/prismjs@1.29.0/themes/prism-twilight.min.css" with double quotes (double quotes are probbaly safer because of https://bugs.webkit.org/show_bug.cgi?id=229816)
  • (-) Requires fix in docoff that will have to be, hopefully, removed once Safari is fixed
  • (+) The CSS will load with no redirect

I think I prefer solution 1)

we want solution 1)