jquery/jquery — pull request #1181 by dgalvez (2013-02-23 20:53:01+00:00)
Title: Bug 13393: .FOCUS() RESULTS IN 'UNSPECIFIED ERROR.' IE9, V1.9

I couldn't find a better way to avoid IE9 crashing when evaluating document.activeElement. This patch sets documet.body as the activeElement in case elem.focus() is called before document.readyState !== "complete" and then redefines jQuery.event.special.focus.trigger to avoid re-running the extra check and body.focus() statements.

A test case has been added.

```javascript
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
var focusTrigger = function() {
if ( this !== document.activeElement && this.focus ) {
this.focus();
return false;
}
};

if ( document.readyState !== "complete" ) {
document.body.focus();
jQuery.event.special.focus.trigger = focusTrigger;
}

return focusTrigger.call( this );
},
delegateType: "focusin"
},
```
The bug url: http://bugs.jquery.com/ticket/13393