IANAL, but AFAIK it's absolutely not illegal in California; what's illegal is preventing you from working for a competitor AFTER you quit.
I've never had a salary employment contract in California that DIDN'T say they owned everything I did in my off time, at least if I was working on something in a similar domain. The best contracts explicitly state that I can get an exemption, or that I can work on unrelated projects, but all have the clause.
If it's illegal, a lot of companies are breaking the law.
RTFM here:
http://www.leginfo.ca.gov/cgi-bin/displaycode?section=lab&gr...
Seems pretty clear on the "similar business" front. IIRC that's been the wording in many if not most of the contracts I signed while I was still working as an employee in CA.
I've mostly worked in games, too, and so that pretty much meant "no game dev in my free time," period. A strong motivator to go indie/consulting.
I work in games. If I do something in my free time that's game-related, it's arguably related to the work my company does.
So I quit and started contracting. Now I own what I work on when I'm on my own time.
And if you get caught using any of employers code like Sergey Aleynikov you are SOL
In my engineering days, a company I interviewed for had me prototype some stuff in SolidWorks but gave me the courtesy of working alone. I just had to tell them when I was done. Even this was much more preferable to an in-person on-the-spot tech interview. I got an offer for that job, but if I had to perform the same task with someone watching, I don't think it would have gone as well.
I suppose it could end up being more of a problem for the hiring company after this practice became more widely known.