Ok so, I actually can't seem to solve this using either suggestion.
First, Node.cloneNode seems to copy the entire element, unless I'm missing something. But what I need is to clone just the attributes of the DUMMYTAG element into the proper element, for example:
Input: <div test="a"> What happens:
SetInnerHTML('<body><dummytag test="a"/></body>') Create a "div" element, and copy all attrs (test) from dummytag to it Return the "div" element, which now has the "test" attribute
How can I do this with cloneNode since it must copy to different element type?
Now the second suggestion: if I use SetInnerHTML directly to the parsed tag element, it will fail to work for some of the html elements. I notice that the html element then contains <head> and <body> already, even if it just parses a div.
I figured I could search for <body> and then get its child. But that's not gonna work for some of those pre-defined elements. How can I handle a <head>, <body> or <html> element parse in such situation?
Do you have any ideas?
Thanks, Gabriel