django-bootstrap-datepicker-plus icon indicating copy to clipboard operation
django-bootstrap-datepicker-plus copied to clipboard

Consider using a data attribute rather than dp_config

Open Phyks opened this issue 6 years ago • 5 comments

Hi,

Describe the bug

It seems this Django widget is using the dp_config attribute to pass the datepicker configuration to the JS side (https://github.com/monim67/django-bootstrap-datepicker-plus/blob/22c4299019cb6328eed2938598e323c0d43c5e9a/bootstrap_datepicker_plus/static/bootstrap_datepicker_plus/js/datepicker-widget.js#L7).

It seems this is coming from the Django wrapper and not the underlying Bootstrap DatePicker library (as far as I know).

This is not a big deal but such an attribute (dp_config) is not a valid HTML attribute. Therefore, it makes automatic testing of the HTML validity of pages more difficult as one has to ignore all these false positives.

The standard way of doing this now seems to be using data- attributes (https://developer.mozilla.org/fr/docs/Web/HTML/Attributs_universels/data-*). What about moving to something like data-dp-config?

To Reproduce Steps to reproduce the behavior:

  1. Create a template calling this widget.
  2. Run W3C validator (https://validator.w3.org/nu/) on the resulting HTML.

Expected behavior HTML should be valid.

Thanks!

Phyks avatar Apr 23 '19 14:04 Phyks

Thanks for your feedback, it will be implemented in next release.

monim67 avatar Apr 23 '19 14:04 monim67

Thanks!

Phyks avatar Apr 23 '19 14:04 Phyks

@monim67: I was really excited to see a new release today, but it seems the fix for this issue didn't make it into 3.0.6. Would it be possible to do a 3.0.7 release with this fix soonish?

If there is anything I can do to help getting this merged, such as preparing a pull request, please let me know.

mthuurne avatar Dec 01 '21 14:12 mthuurne

I will fix few more issues over the week and release a new version next week, thanks for the suggestion :+1:

monim67 avatar Dec 01 '21 17:12 monim67

Thanks!

mthuurne avatar Dec 01 '21 18:12 mthuurne