-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Building off #2268, there is a problem when destroying the datepicker where it doesn’t completely get removed from memory. This pull request, 817ce38, removes the instance reference but the actual UI reference is tied to
jquery-ui/ui/widgets/datepicker.js
Line 163 in 54f96ee
this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); |
When the widget is destroyed, the datepicker UI element remains in memory preventing it from closing. #2268 patches this issue by hiding the component, however dpDiv
is still in memory. One solution could be to remove dpDiv from the instance and then set both _curInst = null
and this.dpDiv = null
.
5e4f1b8
However, many unit tests will break because they rely on dpDiv to still exist in memory, requiring the datepicker to be recreated for each test. There is also a problem that many developers rely on hiding the datepicker before destroying it $.datepicker("hide").destroy("destroy")
which will fail because dpDiv
will be null.