Did you try all of the custom styled switch example? The first one didn't visibly work for me on Safari but the others did - the examples are meant to build up a demonstration of the final pattern.
I was just coming back to edit my comment to acknowledge this. My bad! I think the principle still applies, because I have definitely encountered the mistake I thought I was seeing here. But it doesn’t apply to the example. That’s what I get for commenting before the morning coffee sets in :)