mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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>
This commit is contained in:
		
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -15,6 +15,7 @@
 | 
				
			|||||||
        "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
 | 
					        "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
 | 
				
			||||||
        "@primer/octicons": "18.2.0",
 | 
					        "@primer/octicons": "18.2.0",
 | 
				
			||||||
        "@vue/compiler-sfc": "3.2.47",
 | 
					        "@vue/compiler-sfc": "3.2.47",
 | 
				
			||||||
 | 
					        "@webcomponents/custom-elements": "1.5.1",
 | 
				
			||||||
        "add-asset-webpack-plugin": "2.0.1",
 | 
					        "add-asset-webpack-plugin": "2.0.1",
 | 
				
			||||||
        "ansi-to-html": "0.7.2",
 | 
					        "ansi-to-html": "0.7.2",
 | 
				
			||||||
        "asciinema-player": "3.2.0",
 | 
					        "asciinema-player": "3.2.0",
 | 
				
			||||||
@@ -1915,6 +1916,11 @@
 | 
				
			|||||||
        "@xtuc/long": "4.2.2"
 | 
					        "@xtuc/long": "4.2.2"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@webcomponents/custom-elements": {
 | 
				
			||||||
 | 
					      "version": "1.5.1",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@webcomponents/custom-elements/-/custom-elements-1.5.1.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-6T/XT3S1UHDlRWFSxRXdeSoYWczEl78sygNPS7jDyHVrfZcF/pUtWGYgxF4uviH59iPVw1eOWbhubm8CqO0MpA=="
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/@webpack-cli/configtest": {
 | 
					    "node_modules/@webpack-cli/configtest": {
 | 
				
			||||||
      "version": "2.0.1",
 | 
					      "version": "2.0.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@
 | 
				
			|||||||
    "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
 | 
					    "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
 | 
				
			||||||
    "@primer/octicons": "18.2.0",
 | 
					    "@primer/octicons": "18.2.0",
 | 
				
			||||||
    "@vue/compiler-sfc": "3.2.47",
 | 
					    "@vue/compiler-sfc": "3.2.47",
 | 
				
			||||||
 | 
					    "@webcomponents/custom-elements": "1.5.1",
 | 
				
			||||||
    "add-asset-webpack-plugin": "2.0.1",
 | 
					    "add-asset-webpack-plugin": "2.0.1",
 | 
				
			||||||
    "ansi-to-html": "0.7.2",
 | 
					    "ansi-to-html": "0.7.2",
 | 
				
			||||||
    "asciinema-player": "3.2.0",
 | 
					    "asciinema-player": "3.2.0",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					// 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 {
 | 
					window.customElements.define('gitea-origin-url', class extends HTMLElement {
 | 
				
			||||||
  connectedCallback() {
 | 
					  connectedCallback() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user