-
Notifications
You must be signed in to change notification settings - Fork 7
Fix bug that caused changedCallback to fire instead of disconnectedCallback #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
764c3c7
e53f71a
a2f9e1c
89ed312
416d127
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| **/* | ||
|
|
||
| !src/ | ||
| !pkg/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,8 +117,7 @@ class CustomAttributeRegistry { | |
| } | ||
| } | ||
| // Attribute was removed | ||
| else if(newVal == null && !!inst.value) { | ||
| inst.value = newVal; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reasoning here is that So it's more of like In my use cases, I found it useful to know what the last value was during disconnected (and I can automatically infer the DOM's is |
||
| else if(newVal == null) { | ||
| if(inst.disconnectedCallback) { | ||
| inst.disconnectedCallback(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example: if a custom attribute is
some-attribute="", and then it gets removed, thenewValwill benull, and the currentinst.valuewill""which is falsy, which then causes the conditional to incorrectly skip callingdisconnectedCallback.