Bug in IE 7 with 'find' method

Bug in IE 7 with 'find' method


I was able to reproduce this bug in JQuery 1.2.6, 1.3, and 1.3.1 on
Windows XP with Internet Explorer 7.
The use case is that I have a collection of items in a page of HTML,
and I'm using JQuery to build up a JavaScript model (and insert these
list items into Google Maps).
So, I'm selecting on a class and then iterating over all the items in
that class - and performing a find on each item.
The following example should illustrate the bug:
<div class="foo">
<div class="bar">one</div>
</div>
<div class="foo">
<div class="bar">two</div>
</div>
<div class="foo">
<div class="bar">three</div>
</div>
<div class="foo">
<div class="bar">four</div>
</div>
var text;
var foos = $('.foo');
foos.each(function(index, foo) {
text = $(foo).find('.bar').text();
console.log('text: ' + text);
});
In Safari and Firefox on Win and Mac, text is based only on the
descendants of the currently-selected .foo:
one
two
three
four
In IE 7, text is:
onetwothreefour
onetwothreefour
onetwothreefour
onetwothreefour
It seems as if the .find is not respecting the current selection that
it's hanging off of, and is instead traversing the entire document.
These queries are also extremely slow in IE as compared to the
alternatives.