xpepermint / angular-ui-switch

On/off switch button for AngularJS. DEPRECATED!
278 stars 127 forks source link

Directive produces duplicate ID in DOM - Invalid HTML #53

Open massimocode opened 7 years ago

massimocode commented 7 years ago

Please see the following: https://code.angularjs.org/1.4.8/docs/api/ng/service/$compile

It says:

The replacement process migrates all of the attributes / classes from the old element to the new one. See the Directives Guide for an example.

Angular applies ID to the outermost span whilst the code explicitly applies ID manually to the hidden input checkbox. That results in duplicate unnecessary IDs which is invalid HTML.