diff options
author | silverwind <me@silverwind.io> | 2023-10-11 14:34:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 12:34:21 +0000 |
commit | 73b63d93117db36feda11e53099baa8995a38df0 (patch) | |
tree | a31c2ef53292219f9389f592f53aacaf7d678ba9 /web_src/js/utils.js | |
parent | dc04044716088e3786497e200abe1fdfb3a943b6 (diff) | |
download | gitea-73b63d93117db36feda11e53099baa8995a38df0.tar.gz gitea-73b63d93117db36feda11e53099baa8995a38df0.zip |
Replace ajax with fetch, improve image diff (#27267)
1. Dropzone attachment removal, pretty simple replacement
2. Image diff: The previous code fetched every image twice, once via
`img[src]` and once via `$.ajax`. Now it's only fetched once and a
second time only when necessary. The image diff code was partially
rewritten.
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js/utils.js')
-rw-r--r-- | web_src/js/utils.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web_src/js/utils.js b/web_src/js/utils.js index 1b701e1c6a..c82e42d349 100644 --- a/web_src/js/utils.js +++ b/web_src/js/utils.js @@ -128,3 +128,14 @@ export function decodeURLEncodedBase64(base64url) { .replace(/_/g, '/') .replace(/-/g, '+')); } + +const domParser = new DOMParser(); +const xmlSerializer = new XMLSerializer(); + +export function parseDom(text, contentType) { + return domParser.parseFromString(text, contentType); +} + +export function serializeXml(node) { + return xmlSerializer.serializeToString(node); +} |