2011-11-02 34 views
1

我有一個非常簡單的dojo.query通過一個在FireFox和Chrome中工作的xml文檔,但在IE中失敗。在IE中,這一行給出了錯誤'undefined' is null or not an object簡單的dojo.query通過XML文檔在IE中失敗

var result = dojo.query("list > country", response); 

在道場的誤差在的eval代碼情況發生時,在下面的函數。該行數是791

// get an array of child *elements*, skipping text and comment nodes 
var _childElements = function(filterFunc){ 
    filterFunc = filterFunc||yesman; 
    return function(root, ret, bag){ 
     // get an array of child elements, skipping text and comment nodes 
     var te, x = 0, tret = root[childNodesName]; 
     // THE ERROR HAPPENS HERE. tret is 'undefined' 
     while(te = tret[x++]){ 
      if(
       _simpleNodeTest(te) && 
       (!bag || _isUnique(te, bag)) && 
       (filterFunc(te, x)) 
      ){ 
       ret.push(te); 
      } 
     } 
     return ret; 
    }; 
}; 

我已確認(通過IE開發者工具)響應是有效的,並且設置爲IXMLDOMDocument2一個實例,用適當的子節點。由dojo.xhrGet方法提供的響應,其中我有handleAs: "xml"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<countries> 
<list> 
    <country> 
    <code>1</code> 
    <name>UNITED STATES</name> 
    </country> 
    <country> 
    <code>2</code> 
    <name>UNITED KINGDOM</name> 
    </country> 
    <!-- Snip --> 
    </list> 
</countries> 

dojo.query是訪問result變量的首次嘗試。這是一個已知的問題?有沒有解決方法?

+0

'在這個IE行給出錯誤',你能找到它是什麼行嗎?我沒有道場,所以我不能檢查出來 – david

+0

@david讓我切換到開發版本並檢查。 –

+0

@david查看問題的更新。 –

回答

1

我剛剛確認您遇到過a dojo bug。您可以通過升級到1.7解決它,或者你可以嘗試只applying that patch改變

root[childNodesName] 

的ocurrences到

root.children || root.childNodes 

在道場/選擇/ acme.js文件

+0

升級爲我工作! –