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
DatePicker: Get selectedDay by data instead DOM html
`selectDay()` use jQuery `html()` method on `td` cell to get the day value from DOM, but when user use translator or other extension, it return NaN value because the cell can contains non excepted content. We must use data- attribute to ensure that value cannot be altered.
- https://jqueryui.com/resources/demos/datepicker/localization.html
- https://translate.google.com/translate?hl=en&sl=fr&tl=pl&u=https%3A%2F%2Fjqueryui.com%2Fresources%2Fdemos%2Fdatepicker%2Flocalization.html
We got
```html
<td class=" " data-handler="selectDay" data-event="click" data-month="0" data-year="2021">
<a class="ui-state-default" href="#">
<font style="vertical-align: inherit;"><font style="vertical-align: inherit;">22</font></font>
</a>
</td>
```
instead of
```
<td class=" " data-handler="selectDay" data-event="click" data-month="0" data-year="2021">
<a class="ui-state-default" href="#">22</a>
</td>
```
so this cannot work correctly
```
inst.selectedDay = inst.currentDay = $( "a", td ).html();
```
I think it's not a good practice to get value from html DOM element
0 commit comments