Skip to content

[BUGFIX] Issue #21344 - attributes inconsistently getting removed with falsey values#21345

Draft
NullVoxPopuli wants to merge 2 commits intomainfrom
nvp/issue-21344/attribute-craziness
Draft

[BUGFIX] Issue #21344 - attributes inconsistently getting removed with falsey values#21345
NullVoxPopuli wants to merge 2 commits intomainfrom
nvp/issue-21344/attribute-craziness

Conversation

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

No description provided.

NullVoxPopuli and others added 2 commits April 29, 2026 00:22
Previously, `<input autocomplete={{false}}>` rendered `autocomplete="false"`
because the value reached `DefaultDynamicProperty.set` and was assigned to
the DOM property — for string-valued IDL attributes (autocomplete, name,
popover, draggable, translate, …) the browser then coerced `false` to the
literal string "false" and reflected it back as an attribute. The same
pattern affected `SafeDynamicAttribute`/`SafeDynamicProperty` (href, src)
through `sanitizeAttributeValue`'s `String()` coercion, and
`InputValueDynamicAttribute` set `input.value = "false"`.

Bare `attr={{null}}` and `attr={{undefined}}` already removed the attribute
across every dispatch path — `false` is now treated identically. Concat
form (`attr="{{value}}"`) is intentionally unchanged: it continues to
stringify and renders `"false"`.

The shared sentinel test lives in `isAttrRemoval` so the behavior cannot
drift between dispatch paths again.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…44/falsy-attribute-removal

Treat bare {{false}} as a removal sentinel for HTML attributes
@github-actions
Copy link
Copy Markdown
Contributor

📊 Package size report   0.06%↑

File Before (Size / Brotli) After (Size / Brotli)
dist/dev/packages/shared-chunks/dynamic-BDAj918A.js 116.3 kB / 23.5 kB 1%↑118 kB / 2%↑24.1 kB
dist/prod/packages/shared-chunks/element-builder-wwpGTy--.js 22.8 kB / 5.1 kB 8%↑24.5 kB / 11%↑5.7 kB
Total (Includes all files) 5.4 MB / 1.3 MB 0.06%↑5.4 MB / 0.09%↑1.3 MB
Tarball size 1.2 MB 0.2%↑1.2 MB

🤖 This report was automatically generated by pkg-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant