Hi Mgenov,
mgenov <[email protected]> wrote on 01/03/2009 10:58:57 AM:
> Hello Thomas,
> Here is the whole code of the walk method:
No it isn't, if you want more help please submit a
_complete_ standalone example that shows the bug. Please
check my small exaple that works for me:
<svg width="655" height="600" viewBox="0 0 655 600"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
onload="checkChildren('foo', 'bar')">
<script type="text/ecmascript">
<![CDATA[
function checkChildren(src, dst) {
var s = document.getElementById(src);
var d = document.getElementById(dst);
var clst = s.childNodes;
var str = "";
for (var i=0; i<clst.length; i++) {
var c = clst.item(i);
if (c.localName == "tspan")
str += c.textContent + " ";
}
d.appendChild(document.createTextNode(str));
}
]]></script>
<text id="foo" font-size="20" transform="translate(20 40)">QUICK
<tspan dy="20">BROWN</tspan>
<tspan y="20">FOX</tspan>
<tspan dy="20">JUMPS</tspan>
<tspan y="60">OVER</tspan>
<tspan dy="0">THE LAZY</tspan>
</text>
<text id="bar" font-size="20" fill="blue" x="20" y="160"/>
</svg>
> Note that there are no any additional inserts or movements of the
> nodes. Just walking through the tree. About the ordering probably this
is a
> typing mistake. I made another test with similar xml. This is the result
> from the application:
I am fairly certain you are inserting/deleting elements somplace.
Perhaps this is hidden in the visitor code or something.
> It seems that there is some attribute sorting - first are all elements
with
> dy attribute and then are these with y. Any idea where is the problem ?
Since the above example works for me I suspect the problem is in
your code someplace.
> thomas.deweese wrote:
> >
> >
> >
> > Is your walker method moving the children around the child list
> > for the parent? The DOM specifies that getChildNodes
> > returns a 'live' list of node children so that modifications to
> > the children list is immediately visible:
> >
> > http://www.w3.org/TR/DOM-Level-2-Core/core.html#td-live
> >
> > This would mostly explain the odd ordering of children
> > you see: 2 4 6 3 5
> >
> > Two is the first tspan, When it is removed/moved the
> > second child is '4' (since '3' became the first), then
> > '6' is the third child ('3', '5', '6'). I'm not so sure
> > how you wind up with the '3' and '5'.
> >
>
> --
> View this message in context: http://www.nabble.com/SVGOMDocument-
> and-getChildNodes-ordering-tp21254983p21266183.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>