Can any HTML / Javascript geek point me what is wrong with the linked code?

Can any HTML / Javascript geek point me what is wrong with the linked code?

Originally shared by Piotr Antoniak

How to force IE and MS Edge to display/refresh embedded SVG after changing its content in following piece of code?



 
   
    Title
   
 
 
   
   
 

Comments

  1. Missing single quote after the string in line 8?

    ReplyDelete
  2. Right, my mistake. But there is another, m uch more serious problem. I played a bit with this code and I was not able to show a red circle with the button. It did not work on IE nor MS Edge. So I am a bit confused ...

    ReplyDelete
  3. Maybe ask on Stack Overflow, with javascript, edge and svg tags? It could be anything. For example, does Edge need a IE compatibility tag, or a tag that I've forgotten the name of but that specifies the HTML level? Does a SVG linked to an external file work, even if one with internal content not work? Does internal content work if it's hardcoded, just not when inserted by JS?

    ReplyDelete
  4. David Millington​ good idea,thanks.

    ReplyDelete
  5. DOCTYPE should say that it is ok, but perhaps not to close the svg? I.e; ? The unary tags can sometimes f*ck things *p.

    ReplyDelete
  6. Also i'm sure you opened F12 and had an eye on the console and source tabs?

    ReplyDelete
  7. Yes, I did. I noticed that tag is not modified :/ So I am wandering why? It works in FF and Chrome :/

    ReplyDelete
  8. Another example of the problem. Why the alert says SVG content before change: "undefined" instead of SVG content before change: " " ???



       
           
            Title
           
       
         
            Display red circle
           
               
           
       

    ReplyDelete
  9. Known problem, it seems, workaround that maybe works:

    var element = document.getElementsByTagName('svg')[0].childNodes;
    for (i = 0; i < element.length; i++) {
    if (element[i].nodeName != '#text') {
    console.log(element[i]);
    }
    }

    from this link:
    http://stackoverflow.com/questions/28129956/get-innerhtml-of-svg-tag-result-in-undefined-in-ie

    ReplyDelete

Post a Comment