Where to click to change status of a on/off slide bar

toggle button

In a toggle button like above, where should a user click to change the status?

It seems that the standard in most applications is to click on the slide itself. This would make sense as a user can relate this behaviour to a physical switch for which you have to manipulate the actual slide to the other side.

On the other hand, it seems counter-intuitive to me, that in order to turn the switch off, you'd have to click on 'on'.

What is best practice?

Another solution that I can think of would be to make the entire button clickable: Would it be advisable that users can click on either side of the bar, and either one of those clicks will move the switch to the opposite state?