]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Define this.document properly when instantiating a widget on a document or...
authorScott González <scott.gonzalez@gmail.com>
Mon, 7 Nov 2011 13:39:22 +0000 (08:39 -0500)
committerScott González <scott.gonzalez@gmail.com>
Mon, 7 Nov 2011 13:39:22 +0000 (08:39 -0500)
ui/jquery.ui.widget.js

index 578d330ba336496d6c11bb681133a739f5bc4083..56f465b94dd415d55fe94fc37a80ff8921b3cc35 100644 (file)
@@ -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 );
                }