From 992ab853f5cf1fbbb931c84f65ed81bf3114f2af Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Fri, 1 Dec 2023 12:42:45 -0800 Subject: [PATCH] feat: automatically convert disambiguation value to lowercase (#2898) --- .../mgt-element/src/components/customElementHelper.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/mgt-element/src/components/customElementHelper.ts b/packages/mgt-element/src/components/customElementHelper.ts index 9fd1995217..17595c204e 100644 --- a/packages/mgt-element/src/components/customElementHelper.ts +++ b/packages/mgt-element/src/components/customElementHelper.ts @@ -14,12 +14,18 @@ class CustomElementHelper { /** * Adds a disambiguation segment to the custom elements registered with the browser * - * @param {string} disambiguation + * @param {string} disambiguation the disambiguation value to be used, should be lowercase * @return {CustomElementHelper} the current object * @memberof CustomElementHelper */ public withDisambiguation(disambiguation: string) { - if (disambiguation && !this._disambiguation) this._disambiguation = disambiguation; + if (disambiguation && !this._disambiguation) { + this._disambiguation = disambiguation.toLowerCase(); + if (disambiguation !== this._disambiguation) + console.warn( + `🦒: Disambiguation value, ${disambiguation}, should be lowercase. Value has been converted to lowercase, ${this._disambiguation}.` + ); + } return this; }