Description
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:
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):
However when running this code in Linkedom, the element.value
is undefined. And instead the "initial" is stored inside an attribute with name "value":
Hopefully somebody sees what I am doing wrong.
Thanks!!
Bart