I had a lot of problems with jQuery 1.3.2 on only one of my sites. This is a Joomla site, so Mootools is also included on the page (and it is too difficult to remove Mootools). Basically the problem is that calling the main jQuery selector with one selector (for example:, "a", ".myClass"
not "html a", ".myClass td"
) will only return the first element.
I went through the code and narrowed it down to this function in the Sizzle engine:
(see for yourself, line 2058 jquery.js )
var makeArray = function(array, results) {
array = Array.prototype.slice.call( array );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
I will write here again with comments to show the values that I recorded after the call jQuery("a")
:
var makeArray = function(array, results) {
array = Array.prototype.slice.call( array );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
Can someone explain this code to me? And also why does he get rid of all but one of my elements?