Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/l10n/tests/mochitest/chrome.toml
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test L10nOverlays Special treatment of the title element</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript">
/* global L10nOverlays */
"use strict";
function elem(name) {
return function(str) {
const element = document.createElement(name);
element.innerHTML = str;
return element;
};
}
const { translateElement } = L10nOverlays;
{
// Text is fine.
const element = elem("title")``;
const translation = {
value: 'Text',
attributes: null,
};
translateElement(element, translation);
is(
element.innerHTML,
'Text'
);
}
{
// Markup is ignored.
const element = elem("title")``;
const translation = {
value: '<em>Markup</em>',
attributes: null,
};
translateElement(element, translation);
is(
element.textContent,
'<em>Markup</em>'
);
is(
element.innerHTML,
'<em>Markup</em>'
);
}
</script>
</head>
<body>
</body>
</html>