implicitInheritance also inherits hx-get, hx-post and hx-trigger, which htmx 2 never inherited
Los mantenedores suelen responder en 4 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- frontend
Línea de trabajo
Comienza en src/htmx.js, en el selector de herencia alrededor de la línea 293; después, inspecciona la búsqueda de verbos alrededor de la línea 333 y la búsqueda de triggers alrededor de la línea 725. Traza cómo implicitInheritance selecciona los atributos y verifica que los verbos, hx-action, hx-method y hx-trigger queden excluidos, mientras que los atributos de htmx 2 indicados sigan heredándose. Se considera terminado cuando la reproducción realiza un GET al cargarse y envía el formulario mediante POST a /save sin entrar en un bucle de recarga.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
With htmx.config.implicitInheritance = true, htmx 4 inherits hx-get, hx-post and the other verb attributes, and hx-trigger. htmx 2 never inherited these, so the flag does not restore htmx 2 behaviour. htmx-2-compat only sets this flag, so it has the same problem.
Verbs and triggers resolve through __attributeValue, which applies implicit inheritance to every attribute:
- src/htmx.js#L333 verb lookup, checked in the order get, post, put, and so on
- src/htmx.js#L725 trigger lookup
- src/htmx.js#L293 the inheritance selector
Reproduction
A panel loads a form that has its own hx-post:
<meta name="htmx-config" content='{"implicitInheritance": true}'>
<div id="panel" hx-get="/panel" hx-trigger="load"></div>
<!-- /panel returns: -->
<form hx-post="/save" hx-target="#out"><button>save</button></form><div id="out"></div>
| Version | Page load | Click "save" |
|---|---|---|
| 2.0.10 | one GET /panel |
POST /save |
| 4.0.0 | GET /panel in an endless loop |
no POST; the browser submits the form natively |
The form inherits hx-get="/panel", which wins over its own hx-post because get is checked first. It also inherits hx-trigger="load", so every swap starts the next request.
Expected behaviour
Implicit inheritance applies only to the attributes htmx 2 inherited: hx-boost, hx-confirm, hx-disable (was hx-disabled-elt), hx-encoding, hx-headers, hx-include, hx-indicator, hx-push-url, hx-replace-url, hx-select, hx-select-oob, hx-swap, hx-sync, hx-target and hx-vals. Verbs, hx-action, hx-method and hx-trigger are never inherited.
- Lenguaje dominante
- JavaScript
- Estrellas
- 49.6k
- Forks
- 1.7k
- Merge medio
- 9 d 3 h
- PR fusionados (30 d)
- 10
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bigskysoftware/htmx
-
Only the first `from:body target:` trigger fires when there are two on htmx 2Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
bigskysoftware/htmx#4155 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
bigskysoftware/htmx#4151 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
[htmx4] Swap style for boosted elements is not outerSyncPosiblemente ocupada @1cg la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
bigskysoftware/htmx#4138 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
[htmx4] When importing and configuring htmx with JS, you can't turn off indicator CSSPosiblemente ocupada @MichaelWest22 la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
bigskysoftware/htmx#4122 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
No GitHub Release for version 2.0.11Posiblemente ocupada @1cg la tomó hace 9 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
bigskysoftware/htmx#4117 · 1 asignado ·
Los mantenedores suelen responder en 4 días
Todos los issues de bigskysoftware/htmx
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Los mantenedores suelen responder en 1 día
-
CloudredirectAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
0.2.1-rc.3 compatibility: 21 peer ranges enumerate exact versions, so rc.3 is rejectedPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
NanmiCoder/dsh-agent-teams#277 ·
Los mantenedores suelen responder en 1 día
-
[ordering-review] workshop order graph: 1 confirmed ordering problem, 3 cycles are false positivesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
githubnext/gh-aw-workshop#4943 · 1 comentario ·
Los mantenedores suelen responder en 1 día