Skip to content

Commit

Permalink
feat: automatically convert disambiguation value to lowercase (#2898)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinbarron authored Dec 1, 2023
1 parent df8af8c commit 992ab85
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/mgt-element/src/components/customElementHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 992ab85

Please sign in to comment.