angular-ui/bootstrap — pull request #757 by DanWahlin (2013-08-05 03:16:36+00:00)
Title: element.focus() will throw an error for DatePicker w/out jQuery present

I've been using the DatePicker and found a bug in the following area (works when jQuery is present but I'm trying to eliminate jQuery for this particular app). It's currently line 394 that has the problem in the source.

scope.$watch('isOpen', function(value) {
if (value) {
updatePosition();
$document.bind('click', documentClickBind);
element.unbind('focus', elementFocusBind);
--> element.focus(); //should be element[0].focus() at a minimum w/ out jQuery present
} else {
$document.unbind('click', documentClickBind);
element.bind('focus', elementFocusBind);
}

if ( setIsOpen ) {
setIsOpen(originalScope, value);
}
});

The element.focus() will throw an error since the object needs to be unwrapped first. Should be: element[0].focus() at a minimum to unwrap the jqlite object since it doesn't expose focus().