jdvauguet (4) [Avatar] Offline
#1
Hi. I guess creating a whole slew of threads is not a good idea, so I'll stick to this one from now on.

Previous threads:

* http://www.manning-sandbox.com/thread.jspa?threadID=37286&tstart=0
* http://www.manning-sandbox.com/thread.jspa?threadID=37297&tstart=0

Newcomers:

There is an error in the source code for the bamboo.html example:

<label>
<input type="radio" name="rangoon.option" >
value="sweet checked="checked"/>
Sweet-and-sour sauce
</label>

It lacks a " after sweet.
jdvauguet (4) [Avatar] Offline
#2
Re: [typo] reported by jdvauguet
Not a typo, but a suggestion.

In 4.3, when reviewing the jQuery code, one can read the following advice: "That type of assumptive code can be fragile and break easily when its assumptions change, so it’s generally better to make explicitly certain that the visibility of our options matches the state of their respective check boxes." It's about not relying on the initial state of checkboxes and enforce their toggling behavior regarless of the state they were at once jQuery acts upon them for the first time.

Yet, the next move is relying on the initial state of the price text input areas: "Our handler isn’t done yet; it still needs to adjust the state of the quantity text boxes. These boxes are initially disabled and will only be enabled when an appetizer is checked."

This is obviously in violation of the advice, and could easily be fixed by enforcing the initial state in the jQuery loader function:

$('span[price] input[type=text]').attr("disabled", true); // before the event handlers

What do you think?