Skip to content
Permalink
Browse files

Widget: Removed dual storage of widget instances. Fixes #8801 - Widge…

…t: Remove data fallbacks for widget names.
  • Loading branch information...
scottgonzalez committed Nov 9, 2012
1 parent 84cd214 commit d44557f50ad7b3c512bdd8bc2ba3eed5672b3b12
Showing with 6 additions and 15 deletions.
  1. +6 −12 tests/unit/widget/widget_core.js
  2. +0 −3 ui/jquery.ui.widget.js
@@ -89,9 +89,9 @@ test( "custom selector expression", function() {
});

test( "jQuery usage", function() {
expect( 16 );
expect( 14 );

var elem, instance, ret, bcInstance,
var elem, instance, ret,
shouldCreate = false;

$.widget( "ui.testWidget", {
@@ -134,12 +134,6 @@ test( "jQuery usage", function() {
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
equal( ret, elem, "jQuery object returned from method call" );

// 1.9 BC for #7810
// TODO remove
bcInstance = elem.data("testWidget");
equal( typeof bcInstance, "object", "instance stored in .data(pluginName)" );
equal( bcInstance.element[0], elem[0], "element stored on widget" );

ret = elem.testWidget( "getterSetterMethod" );
equal( ret, 5, "getter/setter can act as getter" );
ret = elem.testWidget( "getterSetterMethod", 30 );
@@ -837,7 +831,7 @@ test( "_on() to common element", function() {
ok( true, "handler triggered" );
}
});
var widget = $( "#widget" ).testWidget().data( "testWidget" );
var widget = $( "#widget" ).testWidget().data( "ui-testWidget" );
$( "#widget-wrapper" ).testWidget();
widget.destroy();
$( document ).trigger( "customevent" );
@@ -849,7 +843,7 @@ test( "_off() - single event", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, { foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
}});
@@ -870,7 +864,7 @@ test( "_off() - multiple events", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
@@ -898,7 +892,7 @@ test( "_off() - all events", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
@@ -231,9 +231,6 @@ $.Widget.prototype = {
this.focusable = $();

if ( element !== this ) {
// 1.9 BC for #7810
// TODO remove dual storage
$.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
this._on( this.element, {
remove: function( event ) {

0 comments on commit d44557f

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