&安培; NBSP;在Raphael JS [英]   in Raphael JS
本文介绍了&安培; NBSP;在Raphael JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要做类似的事情:
paper.text(Left, Top, " " + this._p.Label + ":");
paper.text(Left, Top, " " + this._p.Label + ":");
但前置空格不会显示或显示为& nbsp;
in text。
But the prepended whitespace won't show or show as
in text.
我试过:
label.attr({"xml:space": "preserve"});
...无效。
无论如何都要访问Raphael JS中的SVG节点,所以我可以设置
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?)
推荐答案
是的,您绝对可以将该命名空间属性直接应用于Raphael管理的SVG元素。这很简单:
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");
证明功能正常这里。
这篇关于&安培; NBSP;在Raphael JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文