Skip to content

Commit

Permalink
fix: remove custom "falsy" checks from ifDefined (#544)
Browse files Browse the repository at this point in the history
- all string attributes with an empty string value will now be written in the DOM

FIXES: #542
  • Loading branch information
MapTo0 committed Jun 13, 2019
1 parent ac256d5 commit 92a85fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/base/src/renderer/ifDefined.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
lit-html directive that removes and attribute if it is undefined
*/
export default directive(value => part => {
if ((value === undefined || value === null || value === "") && part instanceof AttributePart) {
if ((value === undefined) && part instanceof AttributePart) {
if (value !== part.value) {
const name = part.committer.name;
part.committer.element.removeAttribute(name);
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Link.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a
class="{{classes.main}}"
role="link"
href="{{href}}"
href="{{parsedRef}}"
target="{{target}}"
rel="{{_rel}}"
tabindex="{{tabIndex}}"
Expand Down
4 changes: 4 additions & 0 deletions packages/main/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ class Link extends UI5Element {
},
};
}

get parsedRef() {
return this.href.length > 0 ? this.href : undefined;
}
}

Bootstrap.boot().then(_ => {
Expand Down

0 comments on commit 92a85fa

Please sign in to comment.