HtmlInput changeType new instance causes side effects
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Start by tracing how HtmlInput.setAttribute handles changes to type and how the replacement instance is attached to its page. Use the two testInput examples in the issue as regression cases, checking the serialized page output with page.asXml(). Done means setting type and then name preserves both attributes whether the input is appended before or after the type change.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
In one of the previous versions a breaking change with HtmlInput.setAttribute was introduced.
Currently, when changing type of HtmlInput a new instance is created and the instance worked on is no longer attached.
Looks like this behavior is intended but causes undesired side effects as the user has absolutely no way knowing they are working on a stale object.
(HtmlElementBuilder is a helper class we created, it basically just creates a StringWebResponse and passes it to to PageCreator)
Example 1 :
@Test
public void testInput() {
HtmlPage page = HtmlElementBuilder.createPageFromString("<html><head></head><body></body></html>");
HtmlElement input = (HtmlElement) page.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "test");
page.getBody().appendChild(input);
System.out.println(page.asXml());
}
Which result in this result:
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head/>
<body>
<input type="hidden"/>
</body>
</html>
Another case:
@Test
public void testInput() {
HtmlPage page = HtmlElementBuilder.createPageFromString("<html><head></head><body></body></html>");
HtmlElement input = (HtmlElement) page.createElement("input");
page.getBody().appendChild(input);
input.setAttribute("type", "hidden");
input.setAttribute("name", "test");
System.out.println(page.asXml());
}
Results in:
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head/>
<body>
<input type="hidden"/>
</body>
</html>
There are workarounds for this but this feels very error prone.
- Lenguaje dominante
- JavaScript
- Estrellas
- 952
- Forks
- 183
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 HtmlUnit/htmlunit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de HtmlUnit/htmlunit
Issues similares
-
Package downloads never retry: getUrlWithResuming's retry catch cannot see a rejected requestAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
account: profile bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 5 días
-
ai-driven-fuzzing bug claude Minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
linagora/cozy-client#1777 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
NanmiCoder/dsh-agent-teams#326 ·
Los mantenedores suelen responder en 1 día
-
[guide] AGENTS.md claims the coverage gate, e2e and full lint run on every PR after ADR 0011 focused validationPosiblemente ocupada @hivecommons-hive la tomó hoy. Abiertoagent/guide documentation hive/claimed-by-guide stage/040-covered-by-pr
Dificultad 2/5 1-3 horas Aptitud para principiantes 81/100
cncf/endusers#2006 · 1 comentario ·
Los mantenedores suelen responder en 1 día