aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/webcomponents
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-03-20 23:17:56 +0800
committerGitHub <noreply@github.com>2023-03-20 23:17:56 +0800
commit529bac1950adf4fb72433cb67f66b0eec49224fe (patch)
tree2d92f6b183a7e8bb53dc724bfdda93c5657f6353 /web_src/js/webcomponents
parentccd3a55bf4f07a390e13d48100c58fb937fd3dcf (diff)
downloadgitea-529bac1950adf4fb72433cb67f66b0eec49224fe.tar.gz
gitea-529bac1950adf4fb72433cb67f66b0eec49224fe.zip
Polyfill the window.customElements (#23592)
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 <dev.lh@web.de>
Diffstat (limited to 'web_src/js/webcomponents')
-rw-r--r--web_src/js/webcomponents/GiteaOriginUrl.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/web_src/js/webcomponents/GiteaOriginUrl.js b/web_src/js/webcomponents/GiteaOriginUrl.js
index 47fd13bfc1..c8736ac5c5 100644
--- a/web_src/js/webcomponents/GiteaOriginUrl.js
+++ b/web_src/js/webcomponents/GiteaOriginUrl.js
@@ -1,3 +1,5 @@
+import '@webcomponents/custom-elements'; // automatically adds custom elements for older browsers that don't support it
+
// this is a Gitea's private HTML component, it converts an absolute or relative URL to an absolute URL with the current origin
window.customElements.define('gitea-origin-url', class extends HTMLElement {
connectedCallback() {