From 5750375701b0e15d8010208fad5f912c44adaba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 14 Jul 2008 23:54:16 +0000 Subject: [PATCH] Tabs: Updated to use new trigger() method. --- ui/ui.tabs.js | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index a7099d0be..4013e3ca7 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -134,9 +134,9 @@ $.widget("ui.tabs", { // seems to be expected behavior that the show callback is fired var onShow = function() { - $(self.element).triggerHandler('tabsshow', - [self.fakeEvent('tabsshow'), self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show); - }; + self.trigger('show', null, + self.ui(self.$tabs[o.selected], self.$panels[o.selected])); + }; // load if remote tab if ($.data(this.$tabs[o.selected], 'load.tabs')) @@ -144,7 +144,6 @@ $.widget("ui.tabs", { // just trigger show event else onShow(); - } // clean up to avoid memory leaks in certain versions of IE 6 @@ -198,9 +197,7 @@ $.widget("ui.tabs", { $show[0].style.filter = ''; // callback - $(self.element).triggerHandler('tabsshow', - [self.fakeEvent('tabsshow'), self.ui(clicked, $show[0])], o.show); - + self.trigger('show', null, self.ui(clicked, $show[0])); }); } @@ -229,7 +226,7 @@ $.widget("ui.tabs", { if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass) || $(this).hasClass(o.loadingClass) - || $(self.element).triggerHandler('tabsselect', [self.fakeEvent('tabsselect'), self.ui(this, $show[0])], o.select) === false + || self.trigger('select', null, self.ui(this, $show[0])) === false ) { this.blur(); return false; @@ -354,9 +351,7 @@ $.widget("ui.tabs", { } // callback - this.element.triggerHandler('tabsadd', - [this.fakeEvent('tabsadd'), this.ui(this.$tabs[index], this.$panels[index])], o.add - ); + this.trigger('add', null, this.ui(this.$tabs[index], this.$panels[index])); }, remove: function(index) { var o = this.options, $li = this.$lis.eq(index).remove(), @@ -373,9 +368,7 @@ $.widget("ui.tabs", { this.tabify(); // callback - this.element.triggerHandler('tabsremove', - [this.fakeEvent('tabsremove'), this.ui($li.find('a')[0], $panel[0])], o.remove - ); + this.trigger('remove', null, this.ui($li.find('a')[0], $panel[0])); }, enable: function(index) { var o = this.options; @@ -393,10 +386,7 @@ $.widget("ui.tabs", { o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); // callback - this.element.triggerHandler('tabsenable', - [this.fakeEvent('tabsenable'), this.ui(this.$tabs[index], this.$panels[index])], o.enable - ); - + this.trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index])); }, disable: function(index) { var self = this, o = this.options; @@ -407,9 +397,7 @@ $.widget("ui.tabs", { o.disabled.sort(); // callback - this.element.triggerHandler('tabsdisable', - [this.fakeEvent('tabsdisable'), this.ui(this.$tabs[index], this.$panels[index])], o.disable - ); + this.trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index])); } }, select: function(index) { @@ -461,9 +449,7 @@ $.widget("ui.tabs", { $.data(a, 'cache.tabs', true); // if loaded once do not load them again // callbacks - $(self.element).triggerHandler('tabsload', - [self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load - ); + self.trigger('load', null, self.ui(self.$tabs[index], self.$panels[index])); o.ajaxOptions.success && o.ajaxOptions.success(r, s); // This callback is required because the switch has to take @@ -506,12 +492,6 @@ $.widget("ui.tabs", { $(this).removeClass([o.selectedClass, o.unselectClass, o.disabledClass, o.panelClass, o.hideClass].join(' ')); }); - }, - fakeEvent: function(type) { - return $.event.fix({ - type: type, - target: this.element[0] - }); } });