Skip to content

Commit fe02b69

Browse files
authored
Complete list of attributes that are locked to properties
1 parent bc47623 commit fe02b69

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

documentation/solid-2.0/07-dom.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DOM behavior in Solid 2.0 follows HTML standards by default: attributes over pro
1818
- **Attributes over properties:** Prefer setting attributes rather than properties in almost all cases. Aligns with web components and SSR.
1919
- **Lowercasing:** Use HTML lowercase for built-in attribute names (no camelCase for attributes). Exceptions:
2020
- **Event handlers** remain camelCase (e.g. `onClick`) to keep the `on` modifier clear.
21-
- **Default to attributes** But attributes such as `input.value`, `textarea.value`, `input.checked`, `select.value`, `option.value`, `option.selected`, `video/audio.muted` continue to be handled as props where that avoids confusion. However, attribute/property can still be used as `<input value="default value" prop:value={dynamic()}/>`. Unfortunately this leads to all form fields be special cases.
21+
- **Default to attributes** But attributes such as `input.value`, `input.defaultValue`, `input.checked`, `input.defaultChecked`, `select.value`, `option.value`, `option.selected`, `option.defaultSelected`, `textarea.value`, `textarea.defaultValue`, `video.muted`, `video.defaultMuted`, `audio.muted`, `audio.defaultMuted` continue to be handled as props where that avoids confusion. Unfortunately, this leads to all form fields be special cased. For example: `<input value={dynamicCurrentValue()} defaultValue={dynamicDefaultValue()}/>` either can be dynamic or static, and in the absense of `defaultValue`, then, `value` is SSRed.
2222
- **Namespaces:** `attr:` and `bool:` namespaces are removed; the single standard behavior makes the model consistent.
2323
- **XML Namespaces:** `svg` and `math` work as expected, however when using XML partials, an `xmlns` attribute is required for the browser to create the elements with the correct namespace. Solid adds these automatically to the tags that can recognize as SVG/MathML. For example an `a` tag returned from a partial to be used in XML need `xmlns` added by the user.
2424

@@ -128,4 +128,4 @@ Used as:
128128

129129
## Open questions
130130

131-
- Exact list of "default" props that stay as props (`input.value`, `textarea.value`, `input.checked`, `select.value`, `option.value`, `option.selected`, `video/audio.muted`, …). Generally, stateful DOM properties should be considered on this list.
131+
- Exact list of "default" props that stay as props (`input.value`, `input.defaultValue`, `input.checked`, `input.defaultChecked`, `select.value`, `option.value`, `option.selected`, `option.defaultSelected`, `textarea.value`, `textarea.defaultValue`, `video.muted`, `video.defaultMuted`, `audio.muted`, `audio.defaultMuted`, …). Generally, stateful DOM properties should be considered on this list.

0 commit comments

Comments
 (0)