Skip to main content

Bug Tracker

Side navigation

#7454 closed bug (invalid)

Opened November 10, 2010 01:37AM UTC

Closed November 10, 2010 02:14AM UTC

each() not firing under IE

Reported by: arangas Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4rc
Keywords: Cc:
Blocked by: Blocking:

The following each() does not fire with jQuery 1.4.4rc2 under IE7 or IE8 (but works under Firefox 3.6, Chrome 7 and IE9):

$('Property', result).each(function () {
    var name = $('Name', this).text();
    alert("Name: " + name);

against sample XML:

var result = "\\

May also fail under previous jQuery versions (not tested).

Attachments (0)
Change History (3)

Changed November 10, 2010 01:40AM UTC by arangas comment:1

jsFiddle repro:

Changed November 10, 2010 02:11AM UTC by arangas comment:2

Please close this bug. There is a workaround for this issue in IE:

var properties = $('Property', result);
if ((properties.length == 0) && (jQuery.browser.msie)) {
	// IE screwing up
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	result = xmlDoc;
	properties = $('Property', result);

Changed November 10, 2010 02:14AM UTC by snover comment:3

resolution: → invalid
status: newclosed

Thanks for the report, but this is not a jQuery bug. The elements you are trying to select against are not valid HTML elements, and IE causes any element that it does not recognise to be empty. This same problem happens with HTML5 elements, and is resolvable through a shim.