Skip to content

Commit 529bac1

Browse files
wxiaoguangdelvh
andauthored
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 <[email protected]>
1 parent ccd3a55 commit 529bac1

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
1616
"@primer/octicons": "18.2.0",
1717
"@vue/compiler-sfc": "3.2.47",
18+
"@webcomponents/custom-elements": "1.5.1",
1819
"add-asset-webpack-plugin": "2.0.1",
1920
"ansi-to-html": "0.7.2",
2021
"asciinema-player": "3.2.0",

web_src/js/webcomponents/GiteaOriginUrl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import '@webcomponents/custom-elements'; // automatically adds custom elements for older browsers that don't support it
2+
13
// this is a Gitea's private HTML component, it converts an absolute or relative URL to an absolute URL with the current origin
24
window.customElements.define('gitea-origin-url', class extends HTMLElement {
35
connectedCallback() {

0 commit comments

Comments
 (0)