aboutsummaryrefslogtreecommitdiff
path: root/static/vevent.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-08 18:29:35 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-08 18:29:35 +0100
commit724828b505eb1744e3616990528547e883481f1f (patch)
tree13a9c34fa26f98bd1e0cb15736e39a407ddf8ed3 /static/vevent.ts
parentComment out x-hnh-calendar-name. (diff)
downloadcalp-724828b505eb1744e3616990528547e883481f1f.tar.gz
calp-724828b505eb1744e3616990528547e883481f1f.tar.xz
JS normalize all vevent property keys to upper case.
Diffstat (limited to 'static/vevent.ts')
-rw-r--r--static/vevent.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/static/vevent.ts b/static/vevent.ts
index 377cb6ae..50c3e1a9 100644
--- a/static/vevent.ts
+++ b/static/vevent.ts
@@ -82,13 +82,21 @@ class VEvent {
*/
registered: Redrawable[]
- constructor(properties: Map<uid, VEventValue> = new Map(), components: VEvent[] = []) {
- this.properties = properties;
+ constructor(properties: Map<string, VEventValue> = new Map(), components: VEvent[] = []) {
this.components = components;
this.registered = [];
+ /* Re-normalize all given keys to upper case. We could require
+ * that beforehand, this is much more reliable, for only a
+ * marginal performance hit.
+ */
+ this.properties = new Map;
+ for (const [key, value] of properties) {
+ this.properties.set(key.toUpperCase(), value);
+ }
}
getProperty(key: string): any | undefined {
+ key = key.toUpperCase()
let e = this.properties.get(key);
if (!e) return e;
return e.value;
@@ -99,10 +107,9 @@ class VEvent {
}
setProperty(key: string, value: any) {
- console.log(key, value);
+ key = key.toUpperCase();
let e = this.properties.get(key);
if (!e) {
- key = key.toUpperCase()
let type: ical_type
let type_ = valid_input_types.get(key)
if (type_ === undefined) {
@@ -118,8 +125,6 @@ class VEvent {
e.value = value;
}
for (let el of this.registered) {
- /* TODO update correct fields, allow component to redraw themselves */
- console.log(el);
el.redraw(this);
}
}