mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 19:06:18 +01:00 
			
		
		
		
	Refactor dropzone (#31482)
Refactor the legacy code and remove some jQuery calls.
This commit is contained in:
		| @@ -304,3 +304,17 @@ export function createElementFromHTML(htmlString) { | ||||
|   div.innerHTML = htmlString.trim(); | ||||
|   return div.firstChild; | ||||
| } | ||||
|  | ||||
| export function createElementFromAttrs(tagName, attrs) { | ||||
|   const el = document.createElement(tagName); | ||||
|   for (const [key, value] of Object.entries(attrs)) { | ||||
|     if (value === undefined || value === null) continue; | ||||
|     if (value === true) { | ||||
|       el.toggleAttribute(key, value); | ||||
|     } else { | ||||
|       el.setAttribute(key, String(value)); | ||||
|     } | ||||
|     // TODO: in the future we could make it also support "textContent" and "innerHTML" properties if needed | ||||
|   } | ||||
|   return el; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user