1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 export const getTagValue = (document: Document | Element, tagName: string, defaultValue: string) => {
6 const [el] = Array.from(document.getElementsByTagName(tagName));
7 const URI = el ? htmlDecode(el.innerHTML) : defaultValue;
10 return decodeURI(URI);
16 const htmlDecode = (input: string) => {
17 const out = input.split(' ').map((i) => {
18 const doc = new DOMParser().parseFromString(i, "text/html");
19 if (doc.documentElement !== null) {
20 return doc.documentElement.textContent || '';