Skip to main content

Bug Tracker

Side navigation

#4576 closed bug (invalid)

Opened April 22, 2009 06:57PM UTC

Closed December 02, 2010 08:07AM UTC

.find not performing properly on an XML document.

Reported by: Tegeril Owned by: Tegeril
Priority: minor Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: find, 1.3.2, getelementsbytagname Cc:
Blocked by: Blocking:
Description

If you use this ajax call:


var searchstring = "http://www.99restaurants.com/resources/proxy/KnowWhereProxy.php?state=CT";

$.ajax({

type: "GET",

url: searchstring,

dataType: "xml",

success: function(obj){ onLoadState(obj);}, error:function(msg,x,y){ alert(msg);}

});


and then try to parse the resulting XML like this:


function onLoadState(data) {

var jLocations = $(data).find("Location");

jLocations.each(function(intLocationIndex) {

// do something

});

}


jLocations has a length of 1. If you go var jLocations = data.getElementsByTagName("Location");, jLocations has a length of 16, returning all <Location> tags instead of just the first.

Attachments (0)
Change History (5)

Changed April 22, 2009 07:06PM UTC by Tegeril comment:1

This implementation worked with JQuery 1.2.6.

Changed April 22, 2009 07:39PM UTC by Tegeril comment:2

Rather, the .find implementation worked with 1.2.6, getElementsByTagName is the workaround for 1.3.2. Sorry for the lack of clarification.

Changed August 07, 2009 04:53PM UTC by dmethvin comment:3

component: unfilledselector
owner: → john

Changed November 18, 2010 03:40AM UTC by dmethvin comment:4

owner: johnTegeril
status: newpending

Can you try with the most recent version?

Changed December 02, 2010 08:07AM UTC by trac-o-bot comment:5

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.