clone issue with ui.datePicker, redux (caused by use of $.data)

clone issue with ui.datePicker, redux (caused by use of $.data)


hey folks,
it seems like this has come up in two different exchanges over the
past 12 months. I ran into this issue as well, where using a deep
clone (el.clone(true)) doesn't work for datepicker. The issue seems
to be the use of $.data to store a jquery instance for a given
input.
The problem with doing it like this is this data store won't get
cloned. I went through the code quite a bit and I don't quite
understand why it is setup like this, vs using the event model (even
triggered, attach datepicker to that element which triggered an event,
and tear it down when finished).
I worked around this by removing the $.datepicker.markerClassName,
like so:
tr.find('.' + $.datepicker.markerClassName).removeClass
($.datepicker.markerClassName);
but this is a dangerous hack (easy to forget, have to put it in every
place I clone an element that has a datepicker attached, etc).
If we can remove the use of $.data from the datepicker instance (or at
least a graceful backup where in #.datepicker._getInst it creates an
instance if one doesn't previously exist), then this should be a lot
more robust.
Please let me know if you would like me to submit a patch for this.
Thanks,
adam