Skip to content

Commit cdb9e2a

Browse files
committed
fix(framework): fix scoping of self tag (#4952)
However, there is one use-case when the Input web components uses `ui5-input` inside the InputPopoverTemplate. The solution in this PR is to consider component's own tag and add it to the list of tags subject to scoping, unless the tag is not explicitly excluded via configuration. This seems to be an edge case, so if alternative solution comes to mind, feel free to share it with me. Fixes: #4945 Closes: #4945
1 parent 66604c3 commit cdb9e2a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/base/src/renderer/executeTemplate.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@ import { getCustomElementsScopingSuffix, shouldScopeCustomElement } from "../Cus
99
* @returns {*}
1010
*/
1111
const executeTemplate = (template, component) => {
12-
const tagsToScope = component.constructor.getUniqueDependencies().map(dep => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
12+
const tagsToScope = getTagsToScope(component);
1313
const scope = getCustomElementsScopingSuffix();
1414
return template(component, tagsToScope, scope);
1515
};
1616

17+
/**
18+
* Returns all tags, used inside component's template subject to scoping.
19+
* @param component - the component
20+
* @returns {Array[]}
21+
* @private
22+
*/
23+
const getTagsToScope = component => {
24+
const componentTag = component.constructor.getMetadata().getPureTag();
25+
const tagsToScope = component.constructor.getUniqueDependencies().map(dep => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
26+
27+
if (shouldScopeCustomElement(componentTag)) {
28+
tagsToScope.push(componentTag);
29+
}
30+
31+
return tagsToScope;
32+
};
33+
1734
export default executeTemplate;

0 commit comments

Comments
 (0)