jwehmueller (1) [Avatar] Offline
#1
For the collapsible list example, the test for the state of the child elements was inverted and issued before the newly animated toggle.

The ternary expression inside the click handler checks for the inverse of ':hidden' and reads as follows:

$(this).css('list-style-image', (!$(this).children().is(':hidden')) ? 'url(plus.gif)' : 'url(minus.gif)'

Would it be identical to check for ':visible'?

$(this).css('list-style-image', ($(this).children().is(':visible')) ? 'url(plus.gif)' : 'url(minus.gif)'

Basically, the inversion of the selector threw me off. If you were writing the code from scratch why would you check for "not hidden" vs. "visible"?
mraj (104) [Avatar] Offline
#2
Re: Chapter 5: ternary expression in Listing 5.3
Since the current (v1.4) jQuery API documentation for :hidden and :visible are the same, either version of the code should work. I tried your code (in Firefox) and it worked the same.

Which version you choose is really just a matter of style.