runemadsen / rune.js

A JavaScript library for programming graphic design systems with SVG

Home Page:http://runemadsen.github.io/rune.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Namespace not translating into virtual-dom, vdom-to-html

blockwooddev opened this issue · comments

I'm working with virtual-dom and vdom-to-html, and along that chain the svg namespace attributes get lost. I sent an email about this earlier.

Namespace properties are defined in rune.js here, then gets passed to virtual-dom, which handles them in this loop. Then, this processes as true, and the rest of the loop is skipped and the namespace stays in the properties. When vdom-to-html gets the tree that namespace property gets to here and then is checked against a list of properties to handle. Of course, xmlns isn't on that list, so it gets ignored. Same for xmlns:xlink.

I propose that the solution to this is to add an attribute property in rune.js where the namespace is defined, so it looks like:

 var attrs = {
    attributes: {
        xmlns: 'http://www.w3.org/2000/svg',
        'xmlns:xlink': 'http://www.w3.org/1999/xlink'
    }
}