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

TypeError: window.customElements is undefined after update to 1.19.0 #23590

Closed
veita opened this issue Mar 20, 2023 · 6 comments
Closed

TypeError: window.customElements is undefined after update to 1.19.0 #23590

veita opened this issue Mar 20, 2023 · 6 comments
Labels

Comments

@veita
Copy link

veita commented Mar 20, 2023

Description

After update from 1.18.5 to 1.19.0 the following error is displayed on top of every page.

JavaScript error: TypeError: window.customElements is undefined (https://g.nezwerg.de/assets/js/webcomponents.js?v=1.19.0 @ 1:35). Open browser console to see more details.

Browser console

<anonymous> https://gitea.example.org/assets/js/webcomponents.js:1:35
<anonymous> https://gitea.example.org/assets/js/webcomponents.js:1:2

Is it safe to switch back to 1.18.5?

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.30.2

Operating System

Debian

How are you running Gitea?

Gitea downloaded from https://github.com/go-gitea/gitea/releases/download/v1.19.0/gitea-1.19.0-linux-amd64

Database

PostgreSQL

@veita veita added the type/bug label Mar 20, 2023
@lunny
Copy link
Member

lunny commented Mar 20, 2023

Please clear the browser cache and try again.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 20, 2023

What's your browser version? I guess your browser is too old.

https://caniuse.com/custom-elementsv1 (it's widely supported after 2017~2019)


If there are too many users using browsers without customElements support, maybe we need to polyfill customElements

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 20, 2023

If you could built your own binary, could you try #23592 ?

Or, could you try to use custom templates:

lunny pushed a commit that referenced this issue Mar 20, 2023
Related: #23590

Reference:
https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs

It seems that there are some users using old browsers, so the
`window.customElements` need polyfill.

The Custom Elements would help a lot for Gitea's UI problems, including:

* `<span class="js-pretty-number">`
* `<time data-format>`

So it's worth get polyfill.

---------

Co-authored-by: delvh <[email protected]>
KN4CK3R pushed a commit that referenced this issue Mar 20, 2023
Backport #23592

Close #23590

It seems that some browsers don't support customElements
@u3shit
Copy link

u3shit commented Mar 20, 2023

@wxiaoguang Pale Moon is unfortunately missing from caniuse data (while it has 3 columns for desktop chromium forks and 2 browsers that received no updates in 8 years...), and it still doesn't have a complete customElements implementation: https://repo.palemoon.org/MoonchildProductions/UXP/issues/2135
The head.tmpl workaround fixes the problem for me.

@wxiaoguang
Copy link
Contributor

No worry, #23595 will fix it. It also reminds me to think more about browsers.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 21, 2023

Update: since #23595 has been merged, you could try to get latest 1.19 from https://dl.gitea.com/gitea/1.19/ , it should contains the fix, then you do not need to use the workaround.

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants