mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Widget: Define this.document properly when instantiating a widget on a document or window. Fixes #7835 - Undefined property when creating widgets.
This commit is contained in:
6
ui/jquery.ui.widget.js
vendored
6
ui/jquery.ui.widget.js
vendored
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user