diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-11-07 08:39:22 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-11-07 08:39:22 -0500 |
commit | 8fd6101c3c330be347b50f4e659161d739513162 (patch) | |
tree | 3c55478fc73b55e1895b0c7f923a743382c75efb | |
parent | 900514ad0f1d54291dcbd105df44d4c766e813bd (diff) | |
download | jquery-ui-8fd6101c3c330be347b50f4e659161d739513162.tar.gz jquery-ui-8fd6101c3c330be347b50f4e659161d739513162.zip |
Widget: Define this.document properly when instantiating a widget on a document or window. Fixes #7835 - Undefined property when creating widgets.
-rw-r--r-- | ui/jquery.ui.widget.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 578d330ba..56f465b94 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -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 ); } |