jquery/jquery-ui — pull request #1052 by lukeapage (2013-08-09 14:25:58+00:00)
Title: datepicker: Use the ownerDocument to find the picker in the event handlers. Fixed #9491 - DatePicker does not use the correct ownerDocument (does not support multiple windows)

This fixes
http://bugs.jqueryui.com/ticket/9491

as described in the bug I've done a minimal patch since the date picker is in the process of a re-write.

all the function calls I've patched are called with inst as the first argument and cope with this already.

One extra thing I could do is change the arguments of these functions from id to inst. I could also not make a further wrap in $. Wasn't sure if this was worth it vs any other changes this might break.

I've assumed the reason that the reason it goes to the effort of capturing an id and not inst is for the avoidance of memory leaks - so I haven't changed this logic.

All-in-all a minimal patch.