简体   繁体   English

dojo查询不适用于IE7,但可以在IE8和其他浏览器上使用吗?

[英]dojo query does not work on IE7 but does on IE8 and other browsers?

dojo.query("#foo #bar") which works as expected in FF, Safari, Chrome and IE8, returns an empty list in IE7. dojo.query("#foo #bar")可以在FF,Safari,Chrome和IE8中正常运行,但在IE7中返回一个空列表。

I'm actually searching for a div with id = bar inside another div with id = foo . 我实际上是在id = foo另一个div内搜索id = bar div。
Did I miss something in my query or is this a known issue in IE7?? 我是否错过了查询中的内容,或者这是IE7中的已知问题?

Thanks Jeff 谢谢杰夫

Because ID's are unique you shouldn't ever had to query for two at once. 因为ID是唯一的,所以您不必一次查询两个。 So either modify your query and have a single ID, or, if you need multiple elements with the same 'id', use a class. 因此,要么修改查询并使用一个ID,要么如果您需要多个具有相同“ ID”的元素,请使用一个类。

For the second option, you would then change your query to dojo.query('.bar', dojo.byId('foo')) , which returns elements with class 'bar' that are a child of the element with id 'foo'. 对于第二个选项,然后将查询更改为dojo.query('.bar', dojo.byId('foo')) ,它返回类为'bar'的元素,这些元素是ID为'foo的元素的子元素'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM