-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
JavaScript error: RangeError: invalid value unit for option style #26525
Comments
Can you show a screenshot of the surrounding JS code when you click the error line number in the browser console (F12)? |
The exception is thrown here:
(Hmm, I see Browser: Pale Moon 32.3.1, maybe it's a browser's bug) And, are you using some browser plugins like translators? Does the error still exist in private window? |
PaleMoon bug (incomplete You could test it on this page https://github.github.io/relative-time-element/examples/ and fix the bug accordingly. |
It's not necessarily a "bug", it's just "yet another spec change" and "yet another tacked on API". We did lift our Couldn't this have been implemented a bit more browser-agnostic in Gitea? I mean, not like "relative date formats" are a new thing, at all. |
Before 1.20: the "relative date" is rendered by backend, it doesn't support i18n well. 1.20: by using GitHub's "relative-time" element (#23988) , most date/time/duration texts are rendered by browser. |
Would you consider keeping the backend implementation as a fallback, at least? I mean, just hard throwing an error is always worse than "not supporting i18n well". (as an aside, GitHub has indicated they want to always be on the bleeding edge of new client APIs, so using that as a reference for "what to implement" may not always be a good idea...) |
I am neutral for it, but I am not familiar with the "relative-time" change. Maybe the original author @yardenshoham could suggest. |
For the record, GitHub's relative duration implementation does seem to render correctly in Pale Moon. |
Maybe they use some internal packages or they use some polyfill packages. |
Perhaps we could add some sort of polyfill for the missing NumberFormat API? I see a backend implementation as a step back in terms of evolution |
Just get an (somewhat strange) idea, would PaleMoon like to pack some polyfill packages by default? Then many browser features could be used out-of-box, instead of waiting for a C++ native implemention. 😁 |
That's rather complex and potentially dangerous as we can't just inject scripts into content willy-nilly, especially not if they are part of the browser's internal resources (it breaks the chrome/content boundary); on top, blanked polyfilling will conflict with other websites that may polyfill things themselves. In isolation it might be a good idea but not on the open web, unfortunately. We have an open issue to implement this API now, but no immediate timeline as to when we'll get to it. |
Made some tests, the minimal polyfill is like this (without i18n support):
|
Add minimum polyfill to support "relative-time-element" in PaleMoon #26575 Does it look good or could there be better solutions? |
See the FAQ in #26575 |
I implemented https://formatjs.io/docs/polyfills/intl-numberformat/ with all locales, you are right the size will go from 60KB to 3MB, I wanted to only load the needed locale but that requires dynamic import which is asynchronous but we need it before we register the web component... Also we can't register the web component after the locale load because the HTML already has the |
…26575) (#26578) Backport #26575 by @wxiaoguang Close #26525 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Description
Visit https://gitea.example.org/admin. The following error is shown on a red bar on the webpage:
Gitea Version
1.20.2
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
git version 2.39.2
Operating System
Debian 12 Bookworm
How are you running Gitea?
Gitea binary downloaded from https://github.com/go-gitea/gitea/releases/download/ and run as a Systemd service.
Browser: Pale Moon 32.3.1.
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: