Widget: Removed dual storage of widget instances. Fixes #8801 - Widget: Remove data fallbacks for widget names.

This commit is contained in:
Scott González 2012-11-09 12:51:26 -05:00
parent 84cd214486
commit d44557f50a
2 changed files with 6 additions and 15 deletions

View File

@ -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" );

View File

@ -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 ) {