timmywil / jquery.onoff

Interactive, accessible toggle switches for the web.
http://timmywil.github.io/jquery.onoff/
MIT License
91 stars 22 forks source link

proto.io generated html is wrong #4

Closed linakis closed 10 years ago

linakis commented 10 years ago

The generated html from http://proto.io/freebies/onoff/ is providing the following snippet:

<div class="onoffswitch">
    <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">
    <label class="onoffswitch-label" for="myonoffswitch">
        <span class="onoffswitch-inner"></span>
        <span class="onoffswitch-switch"></span>
    </label>
</div>

where the correct one (also mentioned in your README) is:

<div class="onoffswitch">
  <input type="checkbox" class="onoffswitch-checkbox" id="myonoffswitch" />
  <label class="onoffswitch-label" for="myonoffswitch">
    <div class="onoffswitch-inner"></div>
    <div class="onoffswitch-switch"></div>
  </label>
</div>

The difference is the div instead of span inside the label that prevented the plugin to properly figure out how to render itself.

timmywil commented 10 years ago

Thanks, I think proto.io actually has it right. Technically, labels can only have phrasing content as descendants (which includes span but not div). I can fix this easily enough.

linakis commented 10 years ago

hmm strange... I didin't spend much time on it, I just made it work and stayed there.

:+1: for the fix