From: Scott González Date: Fri, 9 Nov 2012 17:51:26 +0000 (-0500) Subject: Widget: Removed dual storage of widget instances. Fixes #8801 - Widget: Remove data... X-Git-Tag: 1.10.0-beta.1~189 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d44557f50ad7b3c512bdd8bc2ba3eed5672b3b12;p=jquery-ui.git Widget: Removed dual storage of widget instances. Fixes #8801 - Widget: Remove data fallbacks for widget names. --- diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 9180072e3..b0812638a 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.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" ); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 83696e940..65ac155ae 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -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 ) {