i18n-html to i18n-text if possible. tNodeList now parses HTML content using tHTML
This commit is contained in:
parent
0955fc852c
commit
332f95e1ff
|
@ -61,7 +61,7 @@
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
<template data-id="appliesToEverything">
|
<template data-id="appliesToEverything">
|
||||||
<li class="applies-to-everything" i18n-html="appliesToEverything">
|
<li class="applies-to-everything" i18n-text="appliesToEverything">
|
||||||
<button class="add-applies-to" i18n-text="appliesSpecify"></button>
|
<button class="add-applies-to" i18n-text="appliesSpecify"></button>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -96,7 +96,11 @@ function tNodeList(nodes) {
|
||||||
node.appendChild(document.createTextNode(value));
|
node.appendChild(document.createTextNode(value));
|
||||||
break;
|
break;
|
||||||
case 'html':
|
case 'html':
|
||||||
node.insertAdjacentHTML('afterbegin', value);
|
// localized strings only allow having text nodes and links
|
||||||
|
node.textContent = '';
|
||||||
|
[...tHTML(value, 'div').childNodes]
|
||||||
|
.filter(a => a.nodeType === a.TEXT_NODE || a.tagName === 'A')
|
||||||
|
.forEach(n => node.appendChild(n));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
node.setAttribute(type, value);
|
node.setAttribute(type, value);
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
|
|
||||||
<template data-id="extraAppliesTo">
|
<template data-id="extraAppliesTo">
|
||||||
<details class="applies-to-extra">
|
<details class="applies-to-extra">
|
||||||
<summary i18n-html="appliesDisplayTruncatedSuffix"></summary>
|
<summary i18n-text="appliesDisplayTruncatedSuffix"></summary>
|
||||||
</details>
|
</details>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user