On Jul 9, 2009, at 9:15 PM, Robert O'Callahan wrote:
On Fri, Jul 10, 2009 at 3:04 PM, Maciej Stachowiak <m...@apple.com>
wrote:
Robert's code is a bit buggy; canPlayType returns a string, not a
boolean, so it will always appear to say yes.
You're being polite, my code was not "a bit buggy", it was
completely broken.
I've actually made this mistake several times while writing tests
recently, so I should have known better.
I actually anticipated this problem, and argued strenuously to break
canPlayType into two boolean functions, "canPlayType" and
"cannotPlayType", but I lost. Hopefully most Web authors are smarter
than I am.
I think at one point I suggested that canPlayType should return one of
boolean false, true or "maybe", so that naiive boolean tests would
work. Or in any case, make the "no" option something that tests as
boolean false.
- Maciej