I've been given the task of updating some Javascript for IE10. I've searched endlessly for a solution, but I just can't seem to find one. The piece of code I'm stuck at is:
var svgns = "http://www.w3.org/2000/svg";
this.svgDoc = document.getElementById("SVGDoc").getSVGDocument();
this.grp = this.svgDoc.createElementNS(svgns, "g");
this.grp.setAttribute("id", this.id);
if (this.parent)
this.svgDoc.getElementById(this.parent.id).appendChild(this.grp);
else
this.svgDoc.getDocumentElement.appendChild(this.grp);
The last line is where it fails, giving me the error Unable to get property appendChild
of undefined or null reference . I can't seem to figure out why it is a null reference as it worked with IE8 and lower.
getDocumentElement应该只是documentElement根据工程上几乎所有IE版本, 这
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.