Seems the site is down, or is this rather a technical error for the Errata?
It should be back now. I was moving the site and it was down for a bit.
Confirmed, thank you.
Not sure if this goes better into a suggestion on the errata, pls tell me if you’d prefer that.
Two thoughts on your usage of jQuery in page 33 of pdf version p0
- Usage of $link for results of jQuery (selector) call.
link = $(this)
$link = $(this)
I was wondering if you were aware of that convention and just chose not to follow it for whatever reason (e.g. that it is ugly).
Usage of the jQuery data function, so
There’s a note about not using the jQuery .data() function - I need to explain it better though.
While the .data function supports HTML5 attributes, it isn’t really designed around them. For example, it can read them, but it typecasts the data and that’s not always clear. In this case it wouldn’t be an issue, but where people really get in trouble is using the “setter” variant, as it doesn’t write the value back onto the HTML attribute - it merely caches it on the jQuery object. So to keep things simple, I’ve just not used it.
As for prefixing the variables with the $, I personally don’t like that style. I know developers do it, and I know it’s hotly contested, but I haven’t really been a fan of it personally. It’s not a closed issue though. If enough people pressure me into it I might change it.
Thx for the explanation Brian. I am not a fan of the $ convention for aesthetic reasons but find the added information useful. I have no strong opinion on this. As for the data function I (i) missed the note (probably because of the small display size of my Samsung but not really an excuse) which is (ii) clear enough I feel for the context (now read on my laptop).
As an update, I actually modified that example to use regular vanilla getAttribute, since there’s really no reason to use jQuery for anything other than the event handler in this case. This should be less confusing and should avoid the discussion entirely.
Remarkable you got out from “using a hammer every problem looks like a nail”.