From a78c871076c594c5ca3c5c707f682d30226e5722 Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Mon, 5 Oct 2020 10:27:12 +0300 Subject: [PATCH] fix(framework): Allow role as a property name (#2290) --- packages/base/src/UI5Element.js | 4 ++-- packages/base/src/util/isValidPropertyName.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/base/src/UI5Element.js b/packages/base/src/UI5Element.js index 2084c92b215a..a7e45618054e 100644 --- a/packages/base/src/UI5Element.js +++ b/packages/base/src/UI5Element.js @@ -890,7 +890,7 @@ class UI5Element extends HTMLElement { const properties = this.getMetadata().getProperties(); for (const [prop, propData] of Object.entries(properties)) { // eslint-disable-line if (!isValidPropertyName(prop)) { - throw new Error(`"${prop}" is not a valid property name. Use a name that does not collide with DOM APIs`); + console.warn(`"${prop}" is not a valid property name. Use a name that does not collide with DOM APIs`); /* eslint-disable-line */ } if (propData.type === Boolean && propData.defaultValue) { @@ -946,7 +946,7 @@ class UI5Element extends HTMLElement { const slots = this.getMetadata().getSlots(); for (const [slotName, slotData] of Object.entries(slots)) { // eslint-disable-line if (!isValidPropertyName(slotName)) { - throw new Error(`"${slotName}" is not a valid property name. Use a name that does not collide with DOM APIs`); + console.warn(`"${slotName}" is not a valid property name. Use a name that does not collide with DOM APIs`); /* eslint-disable-line */ } const propertyName = slotData.propertyName || slotName; diff --git a/packages/base/src/util/isValidPropertyName.js b/packages/base/src/util/isValidPropertyName.js index e7f9b8a8c414..d5cbe7883d32 100644 --- a/packages/base/src/util/isValidPropertyName.js +++ b/packages/base/src/util/isValidPropertyName.js @@ -4,6 +4,8 @@ const whitelist = [ "disabled", "title", "hidden", + "role", + "draggable", ]; /**