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
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?
Missing single quote after the string in line 8?
ReplyDeleteRight, 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 ...
ReplyDeleteMaybe 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?
ReplyDeleteDavid Millington​ good idea,thanks.
ReplyDeleteDOCTYPE should say that it is ok, but perhaps not to close the svg? I.e; ? The unary tags can sometimes f*ck things *p.
ReplyDeleteAlso i'm sure you opened F12 and had an eye on the console and source tabs?
ReplyDeleteYes, I did. I noticed that tag is not modified :/ So I am wandering why? It works in FF and Chrome :/
ReplyDeleteAnother example of the problem. Why the alert says SVG content before change: "undefined" instead of SVG content before change: " " ???
ReplyDeleteTitle
Display red circle
Known problem, it seems, workaround that maybe works:
ReplyDeletevar 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