43081j / 43081j/eslint-plugin-lit

Consider exception to `no-attribute-value` if type is checkbox/radio

Abierto
#122 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
138
Forks
26
Merge medio
23 h 29 min
PR fusionados (30 d)
4

Descripción

Checkboxes and radios are unique in that they have a default value of `"on"`. If you use property binding, you cannot take advantage of this:

```js
html`` // will submit as string "undefined"
html`` // will submit as empty string ""
html`` // will submit as empty string ""
```

Whereas if you use the attribute binding, you can conditionally render the attribute and fallback to the default:

```js
html`` // will submit as "on"
```

In my testing this works correctly even if a value is initially set, and later changed, or if attribute is later removed.

Happy to attempt a PR if you don't object

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.