diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 14:47:03 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 14:47:03 +0200 |
commit | f0740d215ef76000732cfb169fffa4c4894a307f (patch) | |
tree | b76b8864d667de3811572c1ee74874842d240ad6 | |
parent | c7a08ceb4b591859c01df76c7262e33771941639 (diff) | |
download | web-common-f0740d215ef76000732cfb169fffa4c4894a307f.tar.gz web-common-f0740d215ef76000732cfb169fffa4c4894a307f.tar.bz2 web-common-f0740d215ef76000732cfb169fffa4c4894a307f.zip |
fallback css
-rw-r--r-- | taler-fallback.css | 16 | ||||
-rw-r--r-- | taler-wallet-lib.ts | 10 |
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; } |