How about update the style by setting the dataset? For example:
   powerSwitch.dataset.loading = enabling;
That would be more consistent with the dataset `data-enabled`.