That's a common misconception - dogs don't give anyone affection unconditionally. They have varying degrees of _loyalty_ (some dogs will keep attached someone that beats them), but overall, they clearly evaluate the benefits of the relationship, pick favorites, etc. Like any other animal (humans included) :-)