Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Value of a foreign input element is an attribue

Abierto
#268 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
javascript
Área
web-dev

Línea de trabajo

Comienza ejecutando las dos reproducciones de DOMParser del issue y compara las rutas de análisis de HTML y image/svg+xml para la entrada con foreignObject. Traza cómo la entrada analizada expone su propiedad value frente a su atributo value. La tarea está terminada cuando el caso SVG devuelve el valor inicial mediante my_input.value, coincidiendo con el comportamiento del navegador, con cobertura de regresión para la reproducción.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Dear,

First of all thank for sharing this nice library!

I have an issue when using an html input element as foreign object inside an svg drawing. Not sure if there is anything wrong with this library, or just me doing something not correctly...

BTW if you are wondering why such foreign objects are used, you can here see a demo animation on my wiki to see how it can be used for example for floorplans in home automation.

Case 1: input elements (ok)

I set a default value "Initial" to an input element:

let html = '<html><head></head><body><input id="my_input" value="initial"></body></html>'
let parser = new DOMParser()
let doc = parser.parseFromString(html, 'text/html')
let my_input = doc.querySelector('#my_input')
let value = my_input.value

Both in a browser and using Linkedom the element.value contains that default value:

image

Case 2: input elements as foreign object in svg (nok)

I set a default value "Initial" to an input element, which is a foreign object inside an svg drawing:

let html = '<svg xmlns="http://www.w3.org/2000/svg"><foreignObject><input id="my_input" value="initial" xmlns="http://www.w3.org/1999/xhtml"></foreignObject></svg>'
let parser = new DOMParser()
let doc = parser.parseFromString(html, 'image/svg+xml')
let my_input = doc.querySelector('#my_input')
let value = my_input.value

When running this in a browser, the element.value still contains that default value (as expected):

image

However when running this code in Linkedom, the element.value is undefined. And instead the "initial" is stored inside an attribute with name "value":

image

Hopefully somebody sees what I am doing wrong.

Thanks!!
Bart

Lenguaje dominante
HTML
Estrellas
2.1k
Forks
104
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de WebReflection/linkedom

Todos los issues de WebReflection/linkedom

Issues similares

Más issues de Web Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.