jcblw / vsvg

〰️ A minimal virtual svg dom that allows some basic dom Node api methods.
https://www.npmjs.org/package/vsvg
14 stars 1 forks source link

Clientside Attach to nodes #6

Closed jcblw closed 9 years ago

jcblw commented 9 years ago

While using vsvg client side, vsvg should attach itself to actual nodes so manipulation to those node will effect the DOM node that it originally created.

jcblw commented 9 years ago

was thinking that vsvg.attach or vsvg.mount then pass a dom node and it will attach the dom node and then attempt to parse all the svg xml in innerHTML. eg.

<svg>
    <line />
</svg>

then

var node = document.getElementsByTagName( 'svg' )[ 0 ],
      svg = vsvg.mount( node );

svg.children[ 0 ].setAttribute( 'x1', '0' ); // will set line attribute eg. <line x1="0" />
jcblw commented 9 years ago

this is now done!