Now I am trying to show a long text in an XBL control which is made of
SVG shapes, and I svg:textPath to make the text wrap to lines. I
found that the SVG in XBL control cannot recognize the svg:textPath
normally. I just ignored the textPath elemement! so I make every effor
to made the textPath work.
And then I try to create the text & textPath element with
document.createElementNS with svg namespace. and append the element
node into XBL, (to let it work as markuped), and the text wrapped.
this thing puzzled me.
So I think there must be some difference between "MARKUP" code and
document.createElementNS() in the final result, But I can not tell.
Anyone helps to tell how could I make the svg:textPath work in markup?
below is the markup code: (not working)
<svg:defs>
<svg:path id="browse-description-path" d="m8,0 h456 m-456,16 h456
m-456,16 h456 m-456,16 h456"/>
</svg:defs>
<svg:text id="t13" x="160" y="80" class="small">
<svg:textPath xlink:href="#browse-description-path">text to
show... </textPath>
</svg:text>
below is the javascript code make text & textPath dynamicly, and the
textPath does work:
var ttt = utils.svg.make('text');
ttt.setAttribute('class', 'small');
ttt.setAttribute('x', '16');
ttt.setAttribute('y', '160');
this.appendChild(ttt);
var ppp = utils.svg.make('textPath');
ppp.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href',
'#browse-description-path');
$(ppp).text('text to show...');
ttt.appendChild(ppp);
this.appendChild(ttt);
All the above codes are in a XBL control, so I wonder the problem is
invoved with the namespace, anybody help?
The problem is: relative to what document? The binding document? Or the bound
document?
Relative URIs and XBL don't play together well.
-Boris
in my further effor, I found that when I append a node contains a
svg:textPath element in it, I call "this.appendChild(node)", then the
svg:textPath worked, but when I call some other node (in annoymous
content) to appendChild(node), and the svg:textPath not work, is this
the problem? what is the difference between "this" in a XBL control
and a annoymous element?
You're using a relative URI. Which document is it relative to?
That's my best guess at what's going on given the very much incomplete code you
sent...
> what is the difference between "this" in a XBL control
> and a annoymous element?
There are lots of differences... Can't say much more than that without seeing
more of your code.
-Boris