How to create SVG elements with auto closers [duplicate]

I am trying to create entries in the defs section of the DOM by using


A typical defintion would be:

    <linearGradient id="lampbevel" x1="0" y1="0" x2="1" y2="0">           
        <stop stop-color="#bfbfbf" offset="0" />           
        <stop stop-color="#404040" offset="1" />          

However if I use document.createElement and then examine the DOM, what I get it:

    <linearGradient id="lampbevel" x1="0" y1="0" x2="1" y2="0">           
        <stop stop-color="#bfbfbf" offset="0"></stop>
        <stop stop-color="#404040" offset="1"></stop>

I'm using Firefox and Firebug to test and fault find, Firefox will not render the defs correctly when a closing stop tag is present, but it will if I edit the DOM and correct the references.

Is there anywy to create closed tags using the DOM functions?




asked and answered before: Javascript createElement no end tag

Please check before you post a question again.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.