Skip to content
Permalink
Browse files

Widget: Ensure window and document are defined in _getCreateOptions()

Closes gh-1320
  • Loading branch information
arschmitz authored and scottgonzalez committed Aug 21, 2014
1 parent bfb6507 commit 1abf9fc71f11996168fd81da7ebf25218f5ad4a4
Showing with 9 additions and 5 deletions.
  1. +4 −1 tests/unit/widget/widget_core.js
  2. +5 −4 ui/widget.js
@@ -260,14 +260,17 @@ test( "merge multiple option arguments", function() {
});

test( "._getCreateOptions()", function() {
expect( 1 );
expect( 3 );
$.widget( "ui.testWidget", {
options: {
option1: "valuex",
option2: "valuex",
option3: "value3"
},
_getCreateOptions: function() {
strictEqual( this.window[ 0 ], window, "this.window is properly defined" );
strictEqual( this.document[ 0 ], document, "this.document is properly defined" );

return {
option1: "override1",
option2: "overideX"
@@ -254,10 +254,6 @@ $.Widget.prototype = {
this.element = $( element );
this.uuid = widget_uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );

this.bindings = $();
this.hoverable = $();
@@ -280,6 +276,11 @@ $.Widget.prototype = {
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}

this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );

this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._init();

0 comments on commit 1abf9fc

Please sign in to comment.
You can’t perform that action at this time.