SVGSVGElement.children无法在IE11中工作? [英] SVGSVGElement.children not working in IE11?
问题描述
我在这里有一个非常简单的jsfiddle:
I have a very simple jsfiddle here:
它由以下html组成:
It consists of this html:
<svg></svg>
还有这个javascript:
And this javascript:
alert(document.getElementsByTagName("svg")[0].children);
我希望它能提醒类似"[Object HtmlCollection]"的信息.但是,在IE 11中,它给出了未定义".尽管Internet上声称IE 11确实支持svg,但似乎仍未在 SVGSVGElement
上定义 children
属性.是什么赋予了?
I expect it to alert something like "[Object HtmlCollection]". In IE 11 though, it gives "undefined". It seems that the children
property is not defined on SVGSVGElement
despite claims on the internet that IE 11 does support svg. What gives?
推荐答案
我认为答案是 children
属性尚未正式成为DOM规范的一部分,您可以在其中找到元素接口).有关更多信息(尤其是
children
和 childNodes
之间的区别),请查看
I think the answer is that the children
property is not yet officially part of the DOM specifications, where you'll find childNodes
on the Node interface, but not children
(neither on the Element interface). For further info (especially the difference between children
and childNodes
), have a look at this other answer.
这篇关于SVGSVGElement.children无法在IE11中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!