in Raphael JS

javascript, raphael

Solution

Yes, you can definitely apply that namespaced attribute directly to the SVG element managed by Raphael. It's this simple:

paper.canvas.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");

Demonstrated to be functional here.

Problem

I need to do something like: ``` paper.text(Left, Top, " " + this._p.Label + ":"); paper.text(Left, Top, " " + this._p.Label + ":"); ``` But the prepended whitespace won't show or show as ` ` in text. I've tried: ``` label.attr({"xml:space": "preserve"}); ``` ...with no effect. Is there anyway to access the SVG node in Raphael JS so I can set ``` setAttributeNS("http://www.w3.org/XML/1998/namespace","space","preserve"); ``` (or is there any other way to solve this?)

Original source