You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each day in the calendar is given an HTML id with it's date. This is very handy, e.g. for styling. However, these ids are invalid because they start with a digit. This is an excerpt of the HTML generated by VueDatePicker:
<divclass="dp__calendar_row" role="row"><divid="2024-11-25" role="gridcell" class="dp__calendar_item" tabindex="0" data-test-id="Mon Nov 25 2024 00:00:00 GMT+0100 (Central European Standard Time)"><divclass="dp__cell_inner dp__pointer dp__today dp__date_hover">25</div></div><divid="2024-11-26" role="gridcell" class="dp__calendar_item" tabindex="0" data-test-id="Tue Nov 26 2024 00:00:00 GMT+0100 (Central European Standard Time)"><divclass="dp__cell_inner dp__pointer dp--future dp__date_hover">26</div></div><!-- [...] --></div>
Each day in the calendar is given an HTML id with it's date. This is very handy, e.g. for styling. However, these ids are invalid because they start with a digit. This is an excerpt of the HTML generated by VueDatePicker:
As you can see, the ids assigned are the year, month and day with hyphens in between, e.g.
2024-11-25
. This is not a valid id as per the CSS standard (https://developer.mozilla.org/en-US/docs/Web/CSS/ident).This can cause unexpected problems. For example, running this code will yield an error in the console:
It is possible to escape the first digit (
#\2024-11-25
). This will silence the error but the result will benull
.Tested with Firefox 132 and VueDatePicker v10.0.0.
Solution
Prefix the ids with a string. E.g.
dp-
.The text was updated successfully, but these errors were encountered: