From 8da01b382ce43802ef164b86cc7e8c714d85a0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 11 Jun 2022 23:18:11 +0200 Subject: Follow all instances of tagName with toLowerCase. A HTML document returns tag names as upper case, while xml documents return them as lower case (or possibly their original case). --- static/components/vevent.ts | 2 +- static/globals.ts | 2 +- static/vevent.ts | 10 +++++----- 3 files changed, 7 insertions(+), 7 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/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); } } -- cgit v1.2.3