summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 14:47:03 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 14:47:03 +0200
commitf0740d215ef76000732cfb169fffa4c4894a307f (patch)
treeb76b8864d667de3811572c1ee74874842d240ad6
parentc7a08ceb4b591859c01df76c7262e33771941639 (diff)
downloadweb-common-f0740d215ef76000732cfb169fffa4c4894a307f.tar.gz
web-common-f0740d215ef76000732cfb169fffa4c4894a307f.tar.bz2
web-common-f0740d215ef76000732cfb169fffa4c4894a307f.zip
fallback css
-rw-r--r--taler-fallback.css16
-rw-r--r--taler-wallet-lib.ts10
2 files changed, 25 insertions, 1 deletions
diff --git a/taler-fallback.css b/taler-fallback.css
new file mode 100644
index 0000000..72f7652
--- /dev/null
+++ b/taler-fallback.css
@@ -0,0 +1,16 @@
+/* Fallback stylesheet. Should be included in the document as follows:
+ *
+ * <link rel="stylesheet"
+ * href="taler-fallback.css"
+ * id="taler-presence-stylesheet />
+ *
+ * When either the taler-wallet-lib is included or the wallet is presence,
+ * it will take over this stylesheet for presence detection.
+ *
+ * This fallback stylesheet makes sure that classes for presence detection
+ * are displayed correctly, even if JavaScript is disabled and the wallet
+ * is not present.
+ */
+
+.taler-installed-show { display: none; }
+.taler-installed-hide { display: none; }
diff --git a/taler-wallet-lib.ts b/taler-wallet-lib.ts
index c703246..433f5c3 100644
--- a/taler-wallet-lib.ts
+++ b/taler-wallet-lib.ts
@@ -375,7 +375,15 @@ namespace taler {
// We've taken over the stylesheet now,
// make it clear by clearing all the rules in it
// and making it obvious in the DOM.
- style.innerText = content;
+ if (style.tagName.toLowerCase() === "style") {
+ style.innerText = content;
+ }
+ if (style.sheet) {
+ throw Error("taler-presence-stylesheet should be a style sheet (<link> or <style>)");
+ }
+ while (sheet.rules.length > 0) {
+ sheet.deleteRule(0);
+ }
}
sheet = style.sheet as CSSStyleSheet;
}