Martin Honnen wrote:
>--- In [EMAIL PROTECTED], Jean-David Benamou
><[EMAIL PROTECTED]> wrote:
>
>
>
>
>>I get Javascript errors because I replace nodes and
>>then do JS operations on them while obviously the DOM changes
>>are not complete.
>>
>>
>
>Can you give an example where the error occurs and tell us which SVG
>viewer you are using?
>A DOM call to replaceChild should only return after the change is done.
>
>
>
To be honnest I am not 100% certain this is the reason of the error
but the error occurs ramdomly and it is the only reason I can think of :
I use ASV3 in IE6.
The source code is rather lenghty so here is a part of it :
var node=parseXML(string,doc) ; // ?? string can be big (this is when
errors occur)
pic.replaceChild(node,picf) ; // here is the replace
picf = doc.getElementById('svgAll') ; /// changing names ...
picf.setAttribute('id','picfile');
// alert('ok'); if not commented no errors
//mettre a jour le menu juste ic
// erreur il faut attendre la fin du replace child ...
menus() ; errors occur in this subs
function menus() {
......
var newMenuRoot = parseXML( printNode( doc.getElementById( 'NewMenu' )
), contextMenu );
contextMenu.replaceChild(newMenuRoot, contextMenu.firstChild );
// changing context menu ...
layersmenu = contextMenu.childNodes.item(0).childNodes.item(1).childNodes;
// commence a 1 a cause de header
menuv=doc.getElementById("NewMenu");
layerv=doc.getElementById("layersubs");
mylayersmenu=layerv.childNodes;
updatelayers(); // error occur in this subs
..... }
function updatelayers() {
// note MYlayermeneu ?????
for (var i=1 ; i < mylayersmenu.length ; i++) {
if (mylayersmenu.item(i).getAttribute('checked') == 'no') {
hidelayer(i); } else {
showlayer(i) ; }}} // error occur here
function showlayer(cl) {
var clay = layersmenu.item(cl) ;
clay.setAttribute('checked','yes');
mylayersmenu.item(cl).setAttribute('checked','yes');
var cls = clay.getAttribute('id') ;
var lid= cls.slice(0,cls.length-3) ;
doc.getElementById(lid).setAttribute('display','inline') ; } // error
occur here
these are part of the dom that are replaced.
If I uncomment the alert in the top piece of code everything is fine ...
Thanks
JD
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~->
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/