mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Widget: Removed dual storage of widget instances. Fixes #8801 - Widget: Remove data fallbacks for widget names.
This commit is contained in:
parent
84cd214486
commit
d44557f50a
@ -89,9 +89,9 @@ test( "custom selector expression", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "jQuery usage", function() {
|
test( "jQuery usage", function() {
|
||||||
expect( 16 );
|
expect( 14 );
|
||||||
|
|
||||||
var elem, instance, ret, bcInstance,
|
var elem, instance, ret,
|
||||||
shouldCreate = false;
|
shouldCreate = false;
|
||||||
|
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
@ -134,12 +134,6 @@ test( "jQuery usage", function() {
|
|||||||
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
||||||
equal( ret, elem, "jQuery object returned from method call" );
|
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" );
|
ret = elem.testWidget( "getterSetterMethod" );
|
||||||
equal( ret, 5, "getter/setter can act as getter" );
|
equal( ret, 5, "getter/setter can act as getter" );
|
||||||
ret = elem.testWidget( "getterSetterMethod", 30 );
|
ret = elem.testWidget( "getterSetterMethod", 30 );
|
||||||
@ -837,7 +831,7 @@ test( "_on() to common element", function() {
|
|||||||
ok( true, "handler triggered" );
|
ok( true, "handler triggered" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var widget = $( "#widget" ).testWidget().data( "testWidget" );
|
var widget = $( "#widget" ).testWidget().data( "ui-testWidget" );
|
||||||
$( "#widget-wrapper" ).testWidget();
|
$( "#widget-wrapper" ).testWidget();
|
||||||
widget.destroy();
|
widget.destroy();
|
||||||
$( document ).trigger( "customevent" );
|
$( document ).trigger( "customevent" );
|
||||||
@ -849,7 +843,7 @@ test( "_off() - single event", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "testWidget" );
|
widget = element.testWidget().data( "ui-testWidget" );
|
||||||
widget._on( element, { foo: function() {
|
widget._on( element, { foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
}});
|
}});
|
||||||
@ -870,7 +864,7 @@ test( "_off() - multiple events", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "testWidget" );
|
widget = element.testWidget().data( "ui-testWidget" );
|
||||||
widget._on( element, {
|
widget._on( element, {
|
||||||
foo: function() {
|
foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
@ -898,7 +892,7 @@ test( "_off() - all events", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "testWidget" );
|
widget = element.testWidget().data( "ui-testWidget" );
|
||||||
widget._on( element, {
|
widget._on( element, {
|
||||||
foo: function() {
|
foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
|
3
ui/jquery.ui.widget.js
vendored
3
ui/jquery.ui.widget.js
vendored
@ -231,9 +231,6 @@ $.Widget.prototype = {
|
|||||||
this.focusable = $();
|
this.focusable = $();
|
||||||
|
|
||||||
if ( element !== this ) {
|
if ( element !== this ) {
|
||||||
// 1.9 BC for #7810
|
|
||||||
// TODO remove dual storage
|
|
||||||
$.data( element, this.widgetName, this );
|
|
||||||
$.data( element, this.widgetFullName, this );
|
$.data( element, this.widgetFullName, this );
|
||||||
this._on( this.element, {
|
this._on( this.element, {
|
||||||
remove: function( event ) {
|
remove: function( event ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user