dreyescat / bootstrap-rating

Bootstrap Rating is a jQuery plugin that creates a rating control that uses Bootstrap glyphicons for rating symbols.
http://dreyescat.github.io/bootstrap-rating/
MIT License
192 stars 78 forks source link

valid html #14

Closed tobiasgr closed 9 years ago

tobiasgr commented 9 years ago

Hi Thank you for an awesome, and very simple rating plugin! I tried validate my html after adding your plugin, but this setting:

is not valid html. input with type "hidden" does not have a readonly property.

dreyescat commented 9 years ago

Thanks @tobiasgr! I had no idea that hidden inputs cannot have readonly attributes. Nice you validated it.

I have created a counterpart data-readonly data attribute to replace the regular readonly one. By now both will be allowed but the regular readonly one will be deprecated in favor of the data version attribute.

So this version:

<input type="hidden" class="rating" data-readonly>

should be used instead of:

<input type="hidden" class="rating" readonly>

Now the demo page was successfully checked as HTML5

For documentation:

According to the W3C Markup Validation Service the readonly attribute is not allowed for hidden input elements.

Attribute readonly not allowed on element input at this point. <input type="hidden" class="rating" readonly="readonly" value="3"/>

It is only allowed for:

Attribute readonly is only allowed when the input type is date, datetime, datetime-local, email, month, number, password, search, tel, text, time, url, or week.

tobiasgr commented 9 years ago

Awesome, that was fast! Thanks!