Skip to main content

Bug Tracker

Side navigation

#4748 closed bug (worksforme)

Opened June 11, 2009 07:48PM UTC

Closed October 31, 2010 01:24AM UTC

selector strangeness

Reported by: morgancodes Owned by: john
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

I'm getting inconsistant results across browsers with the following code (note -- files are attached):

test.html

<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01EN"

"http:www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<script type="text/javascript" src="http://ajax.googleapis.com/

ajax/libs/jquery/1.3/jquery.min.js"></script>

</head>

<body>

<script>

var xml;

$.ajax({

type: "GET",

url: "data.xml",

success: function(data){

var node = $("CI:first", data);

var query1 = $("T TX", node).length;

var query2 = $("T", node).find("TX").length;

var msg = '$("T TX", node).length: ' + query1;

msg += "\\n";

msg += '$("T", node).find("TX").length: ' + query2;

alert(msg);

}

});

</script>

</body>

</html>

I'm getting inconsistant results across browsers with the following

test:

test.html

<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01EN"

"http:www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<script type="text/javascript" src="http://ajax.googleapis.com/

ajax/libs/jquery/1.3/jquery.min.js"></script>

</head>

<body>

<script>

$.ajax({

type: "GET",

url: "data.xml",

success: function(data){

var node = $("CI:first", data);

var query1 = $("T TX", node).length;

var query2 = $("T", node).find("TX").length;

var msg = '$("T TX", node).length: ' + query1;

msg += "\\n";

msg += '$("T", node).find("TX").length: ' + query2;

alert(msg);

}

});

</script>

</body>

</html>

data.xml

<?xml version="1.0" encoding="ISO-8859-2"?>

<CNs>

<CI>

<T>

<TX></TX>

</T>

</CI>

<CI>

<T>

<TX></TX>

</T>

</CI>

<CI>

<T>

<TX></TX>

</T>

</CI>

</CNs>

What should happen is this:

  • Load xml via ajax call
  • select an xml node: $("CI:first", data);
  • select a node within that node: $("T TX", node)
  • second selection should only come up with one "TX" tag

However, in IE6 and IE8 (haven't tried IE7), the second selection

seems to ignore the "node" context, and search the entire xml

document. The test runs as expected in FireFox and Safari. Doing it

this way works in IE $("T", node).find("TX"). Any explanations of why $

("T TX", node) doesn't work in IE?

Attachments (2)
  • data.xml (0.2 KB) - added by morgancodes June 11, 2009 07:51PM UTC.
  • test.html (1.0 KB) - added by morgancodes June 11, 2009 07:50PM UTC.
Change History (5)

Changed June 11, 2009 08:01PM UTC by morgancodes comment:1

Note -- please contact morgan@morganpackard.com if you have any questions or if you come up with a fix!

Changed August 09, 2009 02:08AM UTC by dmethvin comment:2

component: unfilledselector
owner: → john

Changed August 19, 2009 09:06PM UTC by morgancodes comment:3

Just filed a similar bug: http://dev.jquery.com/ticket/5078

Changed October 29, 2010 06:14AM UTC by addyosmani comment:4

#5078 is a duplicate of this ticket.

Changed October 31, 2010 01:24AM UTC by snover comment:5

resolution: → worksforme
status: newclosed

test case works for me. Looks like it was fixed in 1.4.