I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class "selected" alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of <container> with the class "selected" alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname "selected" !! alert(bodySelecteds().length); }; var element = $('<ul class="someclass"><li>MyText</li></ul>').appendTo(container); select(element, false); }); </script> </head> <body> <div id="container" style="border:1px solid #ccc;height:300px;width:300px"></div> </body> </html> I will try to explain the error: I'm inserting a node inside the "container" div, and applying a classname "selected" to this node. After this, I want to select the nodes inside "container" that have this classname. Firefox, IE, etc, says that there is one node inside "container". But webkit browsers says that there is a node with this classname in the dom, but not inside "container". I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6