From 8fd6101c3c330be347b50f4e659161d739513162 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 7 Nov 2011 08:39:22 -0500 Subject: [PATCH] Widget: Define this.document properly when instantiating a widget on a document or window. Fixes #7835 - Undefined property when creating widgets. --- ui/jquery.ui.widget.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ); } -- 2.39.5