Side navigation
#3143 closed bug (wontfix)
Opened July 08, 2008 02:13PM UTC
Closed July 15, 2008 02:22AM UTC
Last modified October 30, 2012 02:45PM UTC
XML parsing-related bug in IE
Reported by: | jterran | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | core | Version: | 1.2.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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 (2)
Change History (6)
Changed July 11, 2008 08:16PM UTC by comment:1
Changed July 15, 2008 02:22AM UTC by comment:2
resolution: | → wontfix |
---|---|
status: | new → closed |
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.
Changed November 10, 2008 10:08PM UTC by comment:3
I can't believe this isn't supported.
Changed July 08, 2010 09:32AM UTC by comment:4
wontfix means the patch does work, or not? Why this can't be fixed?
Changed October 30, 2012 02:00PM UTC by comment:5
you made my Day, it worked, thnx!...........:)
Changed October 30, 2012 02:45PM UTC by comment:6
Replying to [comment:6 chandu017@…]:
you made my Day, it worked, thnx!...........:)
Wow! Four years later. Pretty cool. You're welcome :)
Anyone?