Framework7: div-tags within label tags not allowed

Created on 19 May 2015  ·  4Comments  ·  Source: framework7io/framework7

The documentation of f7 contains examples with div-tags within label-tags.

For example (copied from http://www.idangero.us/framework7/docs/checkboxes-radios.html):
<label class="label-checkbox item-content"> <input type="checkbox" name="my-checkbox" value="Books" checked="checked"> <div class="item-media"> <i class="icon icon-form-checkbox"></i> </div> <div class="item-inner"> <div class="item-title">Books</div> </div> </label>

_According to html-spec, this is not allowed, hence html-validatiors would complain that._
(http://stackoverflow.com/questions/18609554/is-div-inside-label-block-correct).

Would be better to replace divs within label with span-elements or do the divs out of the label-tags.

outdated

All 4 comments

Do you really care what html-spec states about it? I am not, as it works like it should everywhere and will work, it hasn't any cons, and of course - it doesn't affect performance or anything else . Anyway, you can just replace all those divs with spans if it really matters for you ;)

Yes, I know, it works;) however, it is not valid html. Automated tests would complain such structure..is there any good reason why you use divs instead of spans within label-tags? (I will replace all such divs with spans..)

is there any good reason why you use divs instead of spans within label-tags

Yes, because they are block elements by default and to keep the same consentient HTML layout through all list-block elements

it is not valid html. Automated tests would complain such structure

I'll ask again :) Who ever cares about valid HTML? It became not relevant since HTML5 ... and especially for mobile apps

Screen readers, strict browsers, etc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Samnan picture Samnan  ·  3Comments

iBinJubair picture iBinJubair  ·  5Comments

russiann picture russiann  ·  5Comments

vousys picture vousys  ·  4Comments

yeli19950109 picture yeli19950109  ·  3Comments