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?)
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.
Although this seems somewhat [1] solved, I came across this discussion about the same issue, which rather suggests replacing spaces with \u00a0
. This can easily be achieved by using the string function .replace(/ /g,'\u00a0')
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With