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>
|
||||
</template>
|
||||
<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>
|
||||
</li>
|
||||
</template>
|
||||
|
|
|
@ -96,7 +96,11 @@ function tNodeList(nodes) {
|
|||
node.appendChild(document.createTextNode(value));
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
node.setAttribute(type, value);
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
<template data-id="extraAppliesTo">
|
||||
<details class="applies-to-extra">
|
||||
<summary i18n-html="appliesDisplayTruncatedSuffix"></summary>
|
||||
<summary i18n-text="appliesDisplayTruncatedSuffix"></summary>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user