summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/content/PlaceHolder.js8
-rw-r--r--src/content/content.js4
-rw-r--r--src/content/onScriptDisabled.js2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/content/PlaceHolder.js b/src/content/PlaceHolder.js
index 37c0198..ce579c2 100644
--- a/src/content/PlaceHolder.js
+++ b/src/content/PlaceHolder.js
@@ -87,23 +87,23 @@ var PlaceHolder = (() => {
this.origin = new URL(url).origin;
let TYPE = `<${this.policyType.toUpperCase()}>`;
- let replacement = document.createElement("a");
+ let replacement = createHTMLElement("a");
replacement.className = "__NoScript_PlaceHolder__";
cloneStyle(element, replacement);
replacement.style.backgroundImage = `url(${ICON_URL})`;
replacement.href = url;
replacement.title = `${TYPE}@${url}`;
- let inner = replacement.appendChild(document.createElement("span"));
+ let inner = replacement.appendChild(createHTMLElement("span"));
inner.className = replacement.className;
- let button = inner.appendChild(document.createElement("button"));
+ let button = inner.appendChild(createHTMLElement("button"));
button.className = replacement.className;
button.setAttribute("aria-label", button.title = _("Close"));
button.value = "close";
button.textContent = "🗙";
- let description = inner.appendChild(document.createElement("span"));
+ let description = inner.appendChild(createHTMLElement("span"));
description.textContent = `${TYPE}@${this.origin}`;
replacement._placeHolderObj = this;
diff --git a/src/content/content.js b/src/content/content.js
index 5ba5076..a74aa0c 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -2,6 +2,10 @@
// debug = () => {}; // XPI_ONLY
+function createHTMLElement(name) {
+ return document.createElementNS("http://www.w3.org/1999/xhtml", name);
+}
+
var _ = browser.i18n.getMessage;
var canScript = true;
diff --git a/src/content/onScriptDisabled.js b/src/content/onScriptDisabled.js
index 2c1c59c..45f1534 100644
--- a/src/content/onScriptDisabled.js
+++ b/src/content/onScriptDisabled.js
@@ -1,7 +1,7 @@
function onScriptDisabled() {
for (let noscript of document.querySelectorAll("noscript")) {
// force show NOSCRIPT elements content
- let replacement = document.createElement("no-script");
+ let replacement = createHTMLElement("no-script");
replacement.innerHTML = noscript.innerHTML;
noscript.parentNode.replaceChild(replacement, noscript);
// emulate meta-refresh