Skip to content

Commit 92a85fa

Browse files
authored
fix: remove custom "falsy" checks from ifDefined (#544)
- all string attributes with an empty string value will now be written in the DOM FIXES: #542
1 parent ac256d5 commit 92a85fa

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

packages/base/src/renderer/ifDefined.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
lit-html directive that removes and attribute if it is undefined
99
*/
1010
export default directive(value => part => {
11-
if ((value === undefined || value === null || value === "") && part instanceof AttributePart) {
11+
if ((value === undefined) && part instanceof AttributePart) {
1212
if (value !== part.value) {
1313
const name = part.committer.name;
1414
part.committer.element.removeAttribute(name);

packages/main/src/Link.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<a
22
class="{{classes.main}}"
33
role="link"
4-
href="{{href}}"
4+
href="{{parsedRef}}"
55
target="{{target}}"
66
rel="{{_rel}}"
77
tabindex="{{tabIndex}}"

packages/main/src/Link.js

+4
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ class Link extends UI5Element {
263263
},
264264
};
265265
}
266+
267+
get parsedRef() {
268+
return this.href.length > 0 ? this.href : undefined;
269+
}
266270
}
267271

268272
Bootstrap.boot().then(_ => {

0 commit comments

Comments
 (0)