diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-06-13 08:00:45 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-06-13 08:00:45 -0400 |
commit | 9608e981498846b3727cc4dad723a7fa7252fd86 (patch) | |
tree | 591ab885bf28ef77be87b2121fe9ecb461e7358f /ui | |
parent | e8b623207abcae500ffb3860378543906cd4e2b2 (diff) | |
download | jquery-ui-9608e981498846b3727cc4dad723a7fa7252fd86.tar.gz jquery-ui-9608e981498846b3727cc4dad723a7fa7252fd86.zip |
Widget: Rename _bind() to _on(). Partial fix for #7795 - Widget: _on and _off.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.accordion.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.menu.js | 7 | ||||
-rw-r--r-- | ui/jquery.ui.slider.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.spinner.js | 4 | ||||
-rw-r--r-- | ui/jquery.ui.tabs.js | 8 | ||||
-rw-r--r-- | ui/jquery.ui.tooltip.js | 4 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 10 |
8 files changed, 23 insertions, 24 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 856b3ba4b..4cfc265a3 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -137,8 +137,8 @@ $.widget( "ui.accordion", { }); } - this._bind( this.headers, { keydown: "_keydown" }); - this._bind( this.headers.next(), { keydown: "_panelKeyDown" }); + this._on( this.headers, { keydown: "_keydown" }); + this._on( this.headers.next(), { keydown: "_panelKeyDown" }); this._setupEvents( options.event ); }, @@ -376,7 +376,7 @@ $.widget( "ui.accordion", { $.each( event.split(" "), function( index, eventName ) { events[ eventName ] = "_eventHandler"; }); - this._bind( this.headers, events ); + this._on( this.headers, events ); }, _eventHandler: function( event ) { diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 2fb7e395c..f73fff96d 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -63,7 +63,7 @@ $.widget( "ui.autocomplete", { .addClass( "ui-autocomplete-input" ) .attr( "autocomplete", "off" ); - this._bind({ + this._on({ keydown: function( event ) { if ( this.element.prop( "readOnly" ) ) { suppressKeyPress = true; @@ -190,7 +190,7 @@ $.widget( "ui.autocomplete", { .zIndex( this.element.zIndex() + 1 ) .hide() .data( "menu" ); - this._bind( this.menu.element, { + this._on( this.menu.element, { mousedown: function( event ) { // prevent moving focus out of the text field event.preventDefault(); @@ -297,7 +297,7 @@ $.widget( "ui.autocomplete", { // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 - this._bind( this.window, { + this._on( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 986cca168..eb0be494c 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -43,7 +43,7 @@ $.widget( "ui.menu", { tabIndex: 0 }) // need to catch all clicks on disabled menu - // not possible through _bind + // not possible through _on .bind( "click.menu", $.proxy(function( event ) { if ( this.options.disabled ) { event.preventDefault(); @@ -56,7 +56,7 @@ $.widget( "ui.menu", { .attr( "aria-disabled", "true" ); } - this._bind({ + this._on({ // Prevent focus from sticking to links inside menu after clicking // them (focus should always stay on UL during navigation). "mousedown .ui-menu-item > a": function( event ) { @@ -122,8 +122,7 @@ $.widget( "ui.menu", { this.refresh(); // TODO: We probably shouldn't bind to document for each menu. - // TODO: This isn't being cleaned up on destroy. - this._bind( this.document, { + this._on( this.document, { click: function( event ) { if ( !$( event.target ).closest( ".ui-menu" ).length ) { this.collapseAll( event ); diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index c302bfe8b..e44d20f7c 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -114,7 +114,7 @@ $.widget( "ui.slider", $.ui.mouse, { $( this ).data( "ui-slider-handle-index", i ); }); - this._bind( this.handles, { + this._on( this.handles, { keydown: function( event ) { var allowed, curVal, newVal, step, index = $( event.target ).data( "ui-slider-handle-index" ); diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index b01feec9a..d6ebc6d87 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -54,13 +54,13 @@ $.widget( "ui.spinner", { this._value( this.element.val(), true ); this._draw(); - this._bind( this._events ); + this._on( this._events ); this._refresh(); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 - this._bind( this.window, { + this._on( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index f3b27cf9d..5878a56a1 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -481,9 +481,9 @@ $.widget( "ui.tabs", { } this.anchors.add( this.tabs ).add( this.panels ).unbind( ".tabs" ); - this._bind( this.anchors, events ); - this._bind( this.tabs, { keydown: "_tabKeydown" } ); - this._bind( this.panels, { keydown: "_panelKeydown" } ); + this._on( this.anchors, events ); + this._on( this.tabs, { keydown: "_tabKeydown" } ); + this._on( this.panels, { keydown: "_panelKeydown" } ); this._focusable( this.tabs ); this._hoverable( this.tabs ); @@ -943,7 +943,7 @@ if ( $.uiBackCompat !== false ) { }, _create: function() { this._super(); - this._bind({ + this._on({ tabsbeforeload: function( event, ui ) { if ( !this.options.spinner ) { return; diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 752c95687..6a7aab706 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -61,7 +61,7 @@ $.widget( "ui.tooltip", { }, _create: function() { - this._bind({ + this._on({ mouseover: "open", focusin: "open" }); @@ -185,7 +185,7 @@ $.widget( "ui.tooltip", { this._trigger( "open", event, { tooltip: tooltip } ); - this._bind( target, { + this._on( target, { mouseleave: "close", focusout: "close", keyup: function( event ) { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index e317d3841..410b7003a 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -224,7 +224,7 @@ $.Widget.prototype = { // TODO remove dual storage $.data( element, this.widgetName, this ); $.data( element, this.widgetFullName, this ); - this._bind({ remove: "destroy" }); + this._on({ remove: "destroy" }); this.document = $( element.style ? // element within the document element.ownerDocument : @@ -245,7 +245,7 @@ $.Widget.prototype = { destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 - // all event bindings should go through this._bind() + // all event bindings should go through this._on() this.element .unbind( "." + this.widgetName ) // 1.9 BC for #7810 @@ -342,7 +342,7 @@ $.Widget.prototype = { return this._setOption( "disabled", true ); }, - _bind: function( element, handlers ) { + _on: function( element, handlers ) { // no element argument, shuffle and use this.element if ( !handlers ) { handlers = element; @@ -395,7 +395,7 @@ $.Widget.prototype = { _hoverable: function( element ) { this.hoverable = this.hoverable.add( element ); - this._bind( element, { + this._on( element, { mouseenter: function( event ) { $( event.currentTarget ).addClass( "ui-state-hover" ); }, @@ -407,7 +407,7 @@ $.Widget.prototype = { _focusable: function( element ) { this.focusable = this.focusable.add( element ); - this._bind( element, { + this._on( element, { focusin: function( event ) { $( event.currentTarget ).addClass( "ui-state-focus" ); }, |