Ticket #3143 (closed bug: wontfix)
XML parsing-related bug in IE
| Reported by: | jterran | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | core | Version: | 1.2.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
The each loop is never entered in IE6/IE7, but works just fine in Firefox 2:
function testXml()
{
var theXml = "<test><item id='1'>one</item><item id='2'>two</item></test>";
$(theXml).find('item').each(function()
{
var theItem = $(this);
var theId = theItem.attr("id");
var theText = theItem.text();
alert("Id=" + theId + " Text=" + theText);
});
}
However, if I introduce a conditional XML DOM parse, the above example works just fine:
function testXml()
{
var theXml = "<test><item id='1'>one</item><item id='2'>two</item></test>";
theXml = parseXml(theXml);
$(theXml).find('item').each(function()
{
var theItem = $(this);
var theId = theItem.attr("id");
var theText = theItem.text();
alert("Id=" + theId + " Text=" + theText);
});
}
function parseXml(xml)
{
if (jQuery.browser.msie)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
}
return xml;
}
Version Info:
/*
- jQuery 1.2.6 - New Wave Javascript *
- Copyright (c) 2008 John Resig (jquery.com)
- Dual licensed under the MIT (MIT-LICENSE.txt)
- and GPL (GPL-LICENSE.txt) licenses. *
- $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- $Rev: 5685 $ */
Attachments
Change History
comment:2 Changed 5 years ago by flesler
- Status changed from new to closed
- Resolution set to wontfix
Check this link : http://docs.jquery.com/Core/jQuery#html The jQuery constructor only supports html, not xml. The string is flushed into a div, that probably why IE blows up. Because the string isn't valid html.
comment:5 Changed 3 years ago by kenorb
wontfix means the patch does work, or not? Why this can't be fixed?
comment:6 follow-up: ↓ 7 Changed 7 months ago by chandu017@…
you made my Day, it worked, thnx!...........:)
comment:7 in reply to: ↑ 6 Changed 7 months ago by jterran
Replying to chandu017@…:
you made my Day, it worked, thnx!...........:)
Wow! Four years later. Pretty cool. You're welcome :)
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


HTML