Skip to content

Commit

Permalink
fix(editing): set false attribute values on update
Browse files Browse the repository at this point in the history
Since we switched from Replace to Update, we now no longer set falsey
attribute values (like the empty string `''` or `0`). This fixes that
issue.
  • Loading branch information
ca-d committed Jul 20, 2022
1 parent 0f661d4 commit 1e6cc4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Editing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
);

Object.entries(action.newAttributes).forEach(([key, value]) => {
if (value) action.element.setAttribute(key, value);
if (value !== null && value !== undefined)
action.element.setAttribute(key, value);
});

return true;
Expand Down

0 comments on commit 1e6cc4e

Please sign in to comment.