Skip to content

[bug] empty string values incorrectly cause changedCallback to fire instead of disconnectedCallback when removing an attribute #16

@trusktr

Description

@trusktr

I noticed that when we remove an attribute, changedAttribute gets called with null values for newVal. This was a bit confusing, as the null values were causing errors, and I didn't know where they were coming from; it wasn't something I expected.

I expected changedCallback to fire only for when values have changed, and arguments to always be strings in this regard.

We already have disconnectedCallback(), so we necessarily need changedCallback('', null) because it means we have to add defensive code to prevent logic from running when we see null values when we could otherwise just rely on disconnectedCallback and have cleaner code without having to check for null.

Is there some cases I may have missed?

Also the README doesn't mention anything about the null value, which would be good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions