Skip to content

Setting string property to undefined, with reflect: true, does not remove the attribute. #872

@bschlenk

Description

@bschlenk

Description

Setting string property to undefined, with reflect: true, does not remove the attribute.

EDIT: I see this is documented here... so my question is, why is this so inconsistent? For strings & numbers, undefined tells it not to change, but for booleans, objects, & arrays, undefined removes the attribute? It would make a lot more sense if undefined & null both removed the attribute for all cases.

Live Demo

https://stackblitz.com/edit/lit-element-example-ahub5j?file=index.html

Steps to Reproduce

  1. Create my-element with mood set to good via attribute
  2. Append my-element to document.body
  3. Set mood to undefined via property
  4. See that the mood attribute is still set

Expected Results

Expected mood attribute to be removed

Actual Results

Mood attribute is still set to great

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 11
  • Safari 10
  • IE 11

Versions

  • lit-element: v2.2.1
  • webcomponents: N/A

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions