Permalink
Browse files

Widget: Define this.document properly when instantiating a widget on …

…a document or window. Fixes #7835 - Undefined property when creating widgets.
  • Loading branch information...
1 parent 900514a commit 8fd6101c3c330be347b50f4e659161d739513162 @scottgonzalez scottgonzalez committed Nov 7, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 ui/jquery.ui.widget.js
View
@@ -195,7 +195,11 @@ $.Widget.prototype = {
if ( element !== this ) {
$.data( element, this.widgetName, this );
this._bind({ remove: "destroy" });
- this.document = $( element.ownerDocument );
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}

0 comments on commit 8fd6101

Please sign in to comment.