mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00: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:
parent
900514ad0f
commit
8fd6101c3c
6
ui/jquery.ui.widget.js
vendored
6
ui/jquery.ui.widget.js
vendored
@ -195,7 +195,11 @@ $.Widget.prototype = {
|
|||||||
if ( element !== this ) {
|
if ( element !== this ) {
|
||||||
$.data( element, this.widgetName, this );
|
$.data( element, this.widgetName, this );
|
||||||
this._bind({ remove: "destroy" });
|
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 );
|
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user