David Mark meinte:
Ah, I love the clarity of the code supplied. Sheer beauty.
$(function() {
Boy, that $ is handy. Takes functions too!
$("#accordion1").addClass("ui-accordion ui-widget ui-helper-
reset")
CSS "resets" are backwards. And I don't see any feature detection at
all (God knows it ain't in jQuery or its UI trappings.)
.find("h3")
Looks like this is all one "chained" statement. And does the poster
sound like someone who owns a debugger? I've seen evidence that none
of them can debug IE, including Resig. No wonder they have so many
unexplained problems with that browser.
.addClass("ui-accordion-header ui-helper-reset ui-
state-default ui-
corner-top ui-corner-bottom")
Love to see these style sheets. How do I know they are as bad as the
JS?
.prepend('<span class="ui-icon ui-icon-triangle-1-e"/
Sure, just compile a little XHTML and "prepend" it right in. How do
people see this as a worthwhile memorization? And these class names
are atrocious.
.hover(function() {
$(this).addClass("ui-state-hover");
},
How about something like:
$.addClass(this, ...);
Not cool? Must create a new jQuery object in every line? See that
new TaskSpeed test. Very validating.
function() {
$(this).removeClass("ui-state-hover");
})
Again.
.click(function() {
$(this).toggleClass("ui-accordion-header-
active").toggleClass("ui-
state-active")
.toggleClass("ui-state-
default").toggleClass("ui-corner-bottom")
.find("> .ui-icon").toggleClass("ui-icon-
triangle-1-e").toggleClass
("ui-icon-triangle-1-s")
Again, again, again. He's up to 5000 function calls at least.
.end().next().toggleClass("ui-accordion-
content-active").toggle();
Gobbledygook. But then, I'm just griping because I haven't memorized
jQuery-speak and can't compete with the amateur accordion players.
return false;
So he can write a decent line of code.
})
.next().addClass("ui-accordion-content ui-helper-reset
ui-widget-
content ui-corner-bottom").hide();
})
Make that 10000 function calls, zero compatibility and only the jQuery
forum(s) to turn to when this thing springs a leak.
And speaking of leaks. All of the jQuery UI folly leaks like a sieve
in IE. Yes, the UI guy knows about this. The "milestone" to fix it
is... well, who cares if you are building a site *today*.
And I agree, it's clear as mud to all but the most devoted jQuery
fans. I doubt the poster understood it either and now he wants to
paste on another layer of gibberish to make it "sortable." This is
how development is done with jQuery. Small wonder the results are so
abysmal.