Ticket #3725 (closed bug: invalid)
Filter expression i.e. $('li:gt(1)') broken since jQuery 1.2.5
| Reported by: | dasjan | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | unfiled | Version: | 1.2.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I've been using a script which works fine with jQuery 1.1 but now had to update to jQuery 1.2.6 for a new script, now the following script doesn't work anymore:
function ndxz_expanding_loader()
{
var speed = 200;
var item_title = new Array(); var items = new Array(); var i = 0; $("#menu ul").each(function() {
items[i] = $("#menu ul").eq(i).children().filter(function (index) { return index > 0; }); /* v1 - hide items if not active */ if (items[i].is(".active") == false) { items[i].hide(); } /* v2 - hide all */ items[i].hide(); apply the clicker $(this).attr('id', 'c' + i); $(this).children(":first").css({ cursor: 'pointer' }); $$(this).attr('onclick', "$('ul#c" + i + " li:gt(0)').toggle(" + speed + ");$('#content').hide();");
i++;
});
}
Script is also viewable here: http://dev.rocho.org/nico-jquery/nico-admin/site/js/menu.js
It works correctly in the current Firefox 3, but not in current versions of Safari, IE and Chrome.
I also tried changing the line:
$(this).attr('onclick', "$('ul#c" + i + " li:gt(0)').toggle(" + speed + ");$('#content').hide();");
to:
$(this).attr('onclick', "$('ul#c" + i + " li:not(:first-child)').toggle(" + speed + ");$('#content').hide();");
and:
$(this).attr('onclick', "$('ul#c" + i + " li').slice(1).toggle(" + speed + ");$('#content').hide();");
The above examples also don't work.
And then downgraded to 1.2.5 which has the same error, 1.2.4 was not released and in jQuery 1.2.3 the script works in all browsers.
I have put up a demo at:
http://dev.rocho.org/nico-jquery
with the version that uses jQuery 1.2.6 only works in FF 3.
If you click on one of the menu items (Arbeiten,Vita, Kontakt) they won't expand on Safari, IE.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
