diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/components/vevent.ts | 2 | ||||
-rw-r--r-- | static/globals.ts | 2 | ||||
-rw-r--r-- | static/user/user-additions.js | 13 | ||||
-rw-r--r-- | static/vevent.ts | 10 |
4 files changed, 17 insertions, 10 deletions
diff --git a/static/components/vevent.ts b/static/components/vevent.ts index b72cda90..2193eabc 100644 --- a/static/components/vevent.ts +++ b/static/components/vevent.ts @@ -15,7 +15,7 @@ abstract class ComponentVEvent extends HTMLElement { constructor(uid?: string) { super(); - this.template = document.getElementById(this.tagName) as HTMLTemplateElement | null + this.template = document.getElementById(this.tagName.toLowerCase()) as HTMLTemplateElement | null let real_uid; diff --git a/static/globals.ts b/static/globals.ts index 2fc12933..ddc9113e 100644 --- a/static/globals.ts +++ b/static/globals.ts @@ -51,7 +51,7 @@ function find_block(uid: uid): ComponentBlock | null { return null; } for (let el of obj.registered) { - if (el.tagName === 'vevent-block') { + if (el.tagName.toLowerCase() === 'vevent-block') { return el as ComponentBlock; } } diff --git a/static/user/user-additions.js b/static/user/user-additions.js index 0de825e8..c0579df5 100644 --- a/static/user/user-additions.js +++ b/static/user/user-additions.js @@ -34,8 +34,10 @@ window.formatters.set('description', (el, d) => { window.salar = new Promise((resolve, reject) => fetch('/static/user/salar.json') - .then(d => d.json()) - .then(d => resolve(d))) + .then(resp => { if (! resp.ok) reject("404"); else resp.json() }) + .then(d => resolve(d)) + .catch(err => reject(err)) +) window.formatters.set('location', async function(el, d) { @@ -46,7 +48,12 @@ window.formatters.set('location', async function(el, d) { return; } - let salar = await window.salar; + try { + let salar = await window.salar; + } catch (e) { + console.warn("Location formatter failed", e); + return; + } let name = m[1] let frag = salar[name]; diff --git a/static/vevent.ts b/static/vevent.ts index 56c9019a..5419eb60 100644 --- a/static/vevent.ts +++ b/static/vevent.ts @@ -298,7 +298,7 @@ function make_vevent_value(value_tag: Element): VEventValue { /* TODO parameters */ return new VEventValue( /* TODO error on invalid type? */ - value_tag.tagName as ical_type, + value_tag.tagName.toLowerCase() as ical_type, make_vevent_value_(value_tag)); } @@ -441,7 +441,7 @@ function xml_to_recurrence_rule(xml: Element): RecurrenceRule { function make_vevent_value_(value_tag: Element): string | boolean | Date | number | RecurrenceRule { /* RFC6321 3.6. */ - switch (value_tag.tagName) { + switch (value_tag.tagName.toLowerCase()) { case 'binary': /* Base64 to binary Seems to handle inline whitespace, which xCal standard reqires @@ -518,10 +518,10 @@ function xml_to_vcal(xml: Element): VEvent { for (var j = 0; j < tag.childElementCount; j++) { let child = tag.childNodes[j]; if (!(child instanceof Element)) continue; - if (child.tagName == 'parameters') { + if (child.tagName.toLowerCase() == 'parameters') { parameters = /* TODO handle parameters */ {}; continue value_loop; - } else switch (tag.tagName) { + } else switch (tag.tagName.toLowerCase()) { /* These can contain multiple value tags, per RFC6321 3.4.1.1. */ case 'categories': @@ -535,7 +535,7 @@ function xml_to_vcal(xml: Element): VEvent { value = make_vevent_value(child); } } - property_map.set(tag.tagName, value); + property_map.set(tag.tagName.toLowerCase(), value); } } |