Skip to content

Commit

Permalink
Document optimization for false/nil attributes (#3012)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorneau authored and chrismccord committed Jan 17, 2024
1 parent 52c3768 commit 0016415
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/phoenix_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,11 @@ defmodule Phoenix.Component do
* `true` - if a value is `true`, the attribute is rendered with no value at all.
For example, `<input required={true}>` is the same as `<input required>`;
* `false` or `nil` - if a value is `false` or `nil`, the attribute is not rendered;
* `false` or `nil` - if a value is `false` or `nil`, the attribute is omitted.
Some attributes may be rendered with an empty value, for optimization
purposes, if it has the same effect as omitting. For example,
`<checkbox checked={false}>` renders to `<checkbox>` while,
`<div class={false}>` renders to `<div class="">`;
* `list` (only for the `class` attribute) - each element of the list is processed
as a different class. `nil` and `false` elements are discarded.
Expand Down

0 comments on commit 0016415

Please sign in to comment.