Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Value of a foreign input element is an attribue

Aperta
#268 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
web-dev

Direzione di ricerca

Inizia eseguendo le due riproduzioni di DOMParser dell’issue, confrontando i percorsi di parsing HTML e image/svg+xml per l’input con foreignObject. Traccia il modo in cui l’input analizzato espone la sua proprietà value rispetto al suo attributo value. Il lavoro è completato quando il caso SVG restituisce il valore iniziale tramite my_input.value, in modo coerente con il comportamento del browser, con una copertura di regressione per la riproduzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
HTML
Stelle
2.1k
Fork
108
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebReflection/linkedom

Tutte le issue di WebReflection/linkedom

Issue simili

Altre issue su Web Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.