Fix #106 + clean attribute clear on reflected props#115
Merged
Conversation
dda5b94 to
007399b
Compare
068fc38 to
0e6b36c
Compare
f5de09e to
5648082
Compare
8c6807e to
f953de8
Compare
5648082 to
f0956e6
Compare
LeaVerou
approved these changes
May 15, 2026
d0b7b51 to
d3413a0
Compare
a02c7fa to
f0956e6
Compare
d0b7b51 to
4c7a82d
Compare
f0956e6 to
78bc87a
Compare
The re-fire previously dispatched a PropChangeEvent with no detail, so a listener that read e.detail.value would crash on the catch-up dispatch while succeeding on the regular dispatch. Populate a minimal detail with source: "initial" (marker for synthetic catch-up) and value (the field whose absence caused the crash). Found while integration-testing nude-element against color-elements (<space-picker value="oklab" onspacechange="…"> exercises this path).
`change.attributeValue ?? change.element.getAttribute(...)` treated an explicit null (callers signaling "clear this attribute") the same as "no override given, look it up on the element." When a reflected prop was set to null or undefined, the fallback re-read the existing attribute, so the clear never happened. Switch to `!== undefined` so `null` propagates to the subsequent `attributeValue === null` branch and removes the attribute. Fixes the "Clearing a reflected prop removes the attribute" regression tests for both `value: undefined` and `value: null`.
78bc87a to
b509235
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two surgical bug fixes against the rolled-back
e344b1fbaseline, stacked on top of #114 so each landing has its own regression test already in place.first_connectedshortcut re-fires (Populate detail on first_connected shortcut re-fires #106) — direct port of1984e21frommain. Flips thefirst_connected shortcut re-fire carries a detailtest.nullin reflected attribute writes —??was treating "clear this attribute" the same as "no override given," so writingnull/undefinedto a reflected prop didn't remove the attribute. Switch to!== undefined. Flips bothClearing a reflected prop removes the attribute / undefinedand/ null.Test plan
npx htest test/index.js— was 88p / 10f / 4s on Behavioral baseline test suite for props/events plugins (#113) #114; now 91p / 7f / 4s. Remaining 7 failures are unrelated bugs the baseline tests intentionally pin.