From 6204e1a3c4197d4c612e786337ee371295364ee2 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 8 Apr 2010 23:21:47 +0200 Subject: The accidental merge of tooltip into master was reverted in master, that revert got merged back into tooltip; now reverting that revert to get the tooltip stuff back, should then make it easy to merge into master once tooltip is done --- ui/jquery.ui.tooltip.js | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 ui/jquery.ui.tooltip.js (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js new file mode 100644 index 000000000..166bff407 --- /dev/null +++ b/ui/jquery.ui.tooltip.js @@ -0,0 +1,145 @@ +/* + * jQuery UI Tooltip @VERSION + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tooltip + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + */ +(function($) { + +// role=application on body required for screenreaders to correctly interpret aria attributes +if( !$(document.body).is('[role]') ){ + $(document.body).attr('role','application'); +} + +var increments = 0; + +$.widget("ui.tooltip", { + options: { + tooltipClass: "ui-widget-content", + content: function() { + return $(this).attr("title"); + }, + position: { + my: "left center", + at: "right center", + offset: "15 0" + } + }, + _init: function() { + var self = this; + this.tooltip = $("
") + .attr("id", "ui-tooltip-" + increments++) + .attr("role", "tooltip") + .attr("aria-hidden", "true") + .addClass("ui-tooltip ui-widget ui-corner-all") + .addClass(this.options.tooltipClass) + .appendTo(document.body) + .hide(); + this.tooltipContent = $("
") + .addClass("ui-tooltip-content") + .appendTo(this.tooltip); + this.opacity = this.tooltip.css("opacity"); + this.element + .bind("focus.tooltip mouseenter.tooltip", function(event) { + self.open(); + }) + .bind("blur.tooltip mouseleave.tooltip", function(event) { + self.close(); + }); + }, + + enable: function() { + this.options.disabled = false; + }, + + disable: function() { + this.options.disabled = true; + }, + + destroy: function() { + this.tooltip.remove(); + $.Widget.prototype.destroy.apply(this, arguments); + }, + + widget: function() { + return this.tooltip; + }, + + open: function() { + var target = this.element; + // already visible? possible when both focus and mouseover events occur + if (this.current && this.current[0] == target[0]) + return; + var self = this; + this.current = target; + this.currentTitle = target.attr("title"); + var content = this.options.content.call(target[0], function(response) { + // ignore async responses that come in after the tooltip is already hidden + if (self.current == target) + self._show(target, response); + }); + if (content) { + self._show(target, content); + } + }, + + _show: function(target, content) { + if (!content) + return; + + target.attr("title", ""); + + if (this.options.disabled) + return; + + this.tooltipContent.html(content); + this.tooltip.css({ + top: 0, + left: 0 + }).position($.extend(this.options.position, { + of: target + })); + + this.tooltip.attr("aria-hidden", "false"); + target.attr("aria-describedby", this.tooltip.attr("id")); + + if (this.tooltip.is(":animated")) + this.tooltip.stop().show().fadeTo("normal", this.opacity); + else + this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); + + this._trigger( "open" ); + }, + + close: function() { + if (!this.current) + return; + + var current = this.current.attr("title", this.currentTitle); + this.current = null; + + if (this.options.disabled) + return; + + current.removeAttr("aria-describedby"); + this.tooltip.attr("aria-hidden", "true"); + + if (this.tooltip.is(':animated')) + this.tooltip.stop().fadeTo("normal", 0); + else + this.tooltip.stop().fadeOut(); + + this._trigger( "close" ); + } + +}); + +})(jQuery); \ No newline at end of file -- cgit v1.2.3 From 84e0ce168f109fbd5482c6c1ba09bbbb55592888 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 15 Apr 2010 09:45:35 +0200 Subject: Tooltip: Unit tests for tooltip and a fix to pass through event objects to triggered events --- tests/unit/index.html | 22 +------------- tests/unit/tooltip/tooltip.html | 43 +++++++++++++++++++++++++++ tests/unit/tooltip/tooltip_core.js | 11 +++++++ tests/unit/tooltip/tooltip_defaults.js | 16 ++++++++++ tests/unit/tooltip/tooltip_events.js | 54 ++++++++++++++++++++++++++++++++++ tests/unit/tooltip/tooltip_methods.js | 23 +++++++++++++++ tests/unit/tooltip/tooltip_options.js | 39 ++++++++++++++++++++++++ tests/unit/tooltip/tooltip_tickets.js | 10 +++++++ ui/jquery.ui.tooltip.js | 18 ++++++------ 9 files changed, 206 insertions(+), 30 deletions(-) create mode 100644 tests/unit/tooltip/tooltip.html create mode 100644 tests/unit/tooltip/tooltip_core.js create mode 100644 tests/unit/tooltip/tooltip_defaults.js create mode 100644 tests/unit/tooltip/tooltip_events.js create mode 100644 tests/unit/tooltip/tooltip_methods.js create mode 100644 tests/unit/tooltip/tooltip_options.js create mode 100644 tests/unit/tooltip/tooltip_tickets.js (limited to 'ui') diff --git a/tests/unit/index.html b/tests/unit/index.html index 4882098d7..ad8c96433 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -19,27 +19,6 @@ } - - - - - - - - - - - - - - - - - - - - - @@ -69,6 +48,7 @@
  • Progressbar
  • Slider
  • Tabs
  • +
  • Tooltip
  • Utilities

    diff --git a/tests/unit/tooltip/tooltip.html b/tests/unit/tooltip/tooltip.html new file mode 100644 index 000000000..37bfeafce --- /dev/null +++ b/tests/unit/tooltip/tooltip.html @@ -0,0 +1,43 @@ + + + + + jQuery UI Tooltip Test Suite + + + + + + + + + + + + + + + + + + + + + + + +

    jQuery UI Tooltip Test Suite

    +

    +

    +
      +
    + +
    +
    + anchor + +
    +
    + + + diff --git a/tests/unit/tooltip/tooltip_core.js b/tests/unit/tooltip/tooltip_core.js new file mode 100644 index 000000000..247927df4 --- /dev/null +++ b/tests/unit/tooltip/tooltip_core.js @@ -0,0 +1,11 @@ +/* + * tooltip_core.js + */ + + +(function($) { + +module("tooltip: core"); + + +})(jQuery); diff --git a/tests/unit/tooltip/tooltip_defaults.js b/tests/unit/tooltip/tooltip_defaults.js new file mode 100644 index 000000000..bcdcd4307 --- /dev/null +++ b/tests/unit/tooltip/tooltip_defaults.js @@ -0,0 +1,16 @@ +/* + * tooltip_defaults.js + */ + +var tooltip_defaults = { + disabled: false, + content: $.ui.tooltip.prototype.options.content, + tooltipClass: "ui-widget-content", + position: { + my: "left center", + at: "right center", + offset: "15 0" + } +}; + +commonWidgetTests('tooltip', { defaults: tooltip_defaults }); diff --git a/tests/unit/tooltip/tooltip_events.js b/tests/unit/tooltip/tooltip_events.js new file mode 100644 index 000000000..51c56b62e --- /dev/null +++ b/tests/unit/tooltip/tooltip_events.js @@ -0,0 +1,54 @@ +/* + * tooltip_events.js + */ +(function($) { + +module("tooltip: events"); + +test("programmatic triggers", function() { + expect(2); + var e = $("#tooltipped1").tooltip({ + open: function(event, ui) { + same( event.type, "tooltipopen" ); + }, + close: function(event, ui) { + same( event.type, "tooltipclose" ); + } + }); + e.tooltip("open").tooltip("close"); + e.tooltip("destroy"); +}); + +test("mouse events", function() { + expect(4); + var e = $("#tooltipped1").tooltip({ + open: function(event, ui) { + same( event.type, "tooltipopen" ); + same( event.originalEvent.type, "mouseenter" ); + }, + close: function(event, ui) { + same( event.type, "tooltipclose" ); + same( event.originalEvent.type, "mouseleave" ); + } + }); + e.trigger("mouseover").trigger("mouseout"); + e.tooltip("destroy"); +}); + +test("focus events", function() { + expect(4); + var e = $("#tooltipped1").tooltip({ + open: function(event, ui) { + same( event.type, "tooltipopen" ); + same( event.originalEvent.type, "focus" ); + }, + close: function(event, ui) { + same( event.type, "tooltipclose" ); + same( event.originalEvent.type, "blur" ); + } + }); + e.trigger("focus").trigger("blur"); + e.tooltip("destroy"); +}); + +})(jQuery); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js new file mode 100644 index 000000000..867923dd0 --- /dev/null +++ b/tests/unit/tooltip/tooltip_methods.js @@ -0,0 +1,23 @@ +/* + * tooltip_methods.js + */ +(function($) { + + +module("tooltip: methods"); + +test("destroy", function() { + var beforeHtml = $("#tooltipped1").parent().html(); + var afterHtml = $("#tooltipped1").tooltip().tooltip("destroy").parent().html(); + equal( afterHtml, beforeHtml ); +}); + +test("open", function() { + var e = $("#tooltipped1").tooltip(); + ok( $(".ui-tooltip").is(":hidden") ); + e.tooltip("open"); + ok( $(".ui-tooltip").is(":visible") ); + $(":ui-tooltip").tooltip("destroy"); +}); + +})(jQuery); diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js new file mode 100644 index 000000000..e0262a947 --- /dev/null +++ b/tests/unit/tooltip/tooltip_options.js @@ -0,0 +1,39 @@ +/* + * tooltip_options.js + */ +(function($) { + +module("tooltip: options"); + +function contentTest(name, expected, impl) { + test(name, function() { + $("#tooltipped1").tooltip({ + content: impl + }).tooltip("open"); + same( $(".ui-tooltip").text(), expected ); + $(":ui-tooltip").tooltip("destroy"); + }); +} + +contentTest("content: default", "anchortitle"); +contentTest("content: return string", "customstring", function() { + return "customstring"; +}); +contentTest("content: callback string", "customstring2", function(response) { + response("customstring2"); +}); + +test("tooltipClass, default", function() { + $("#tooltipped1").tooltip().tooltip("open"); + same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all ui-widget-content"); + $(":ui-tooltip").tooltip("destroy"); +}); +test("tooltipClass, custom", function() { + $("#tooltipped1").tooltip({ + tooltipClass: "pretty fancy" + }).tooltip("open"); + same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all pretty fancy"); + $(":ui-tooltip").tooltip("destroy"); +}); + +})(jQuery); diff --git a/tests/unit/tooltip/tooltip_tickets.js b/tests/unit/tooltip/tooltip_tickets.js new file mode 100644 index 000000000..5d6d0ef86 --- /dev/null +++ b/tests/unit/tooltip/tooltip_tickets.js @@ -0,0 +1,10 @@ +/* + * tooltip_tickets.js + */ +(function($) { + +module("tooltip: tickets"); + + + +})(jQuery); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 166bff407..13c809f45 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -49,10 +49,10 @@ $.widget("ui.tooltip", { this.opacity = this.tooltip.css("opacity"); this.element .bind("focus.tooltip mouseenter.tooltip", function(event) { - self.open(); + self.open( event ); }) .bind("blur.tooltip mouseleave.tooltip", function(event) { - self.close(); + self.close( event ); }); }, @@ -73,7 +73,7 @@ $.widget("ui.tooltip", { return this.tooltip; }, - open: function() { + open: function(event) { var target = this.element; // already visible? possible when both focus and mouseover events occur if (this.current && this.current[0] == target[0]) @@ -84,14 +84,14 @@ $.widget("ui.tooltip", { var content = this.options.content.call(target[0], function(response) { // ignore async responses that come in after the tooltip is already hidden if (self.current == target) - self._show(target, response); + self._show(event, target, response); }); if (content) { - self._show(target, content); + self._show(event, target, content); } }, - _show: function(target, content) { + _show: function(event, target, content) { if (!content) return; @@ -116,10 +116,10 @@ $.widget("ui.tooltip", { else this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); - this._trigger( "open" ); + this._trigger( "open", event ); }, - close: function() { + close: function(event) { if (!this.current) return; @@ -137,7 +137,7 @@ $.widget("ui.tooltip", { else this.tooltip.stop().fadeOut(); - this._trigger( "close" ); + this._trigger( "close", event ); } }); -- cgit v1.2.3 From 99900d57cec7a2b3b4b09397b101bb8d7a7d449c Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Fri, 23 Apr 2010 09:41:19 +0200 Subject: Tooltip: Improve fadeout animation to handle case where tooltip overlays the element, causing it to hide instantly and never appearing again --- ui/jquery.ui.tooltip.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 13c809f45..f64f40248 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -133,7 +133,9 @@ $.widget("ui.tooltip", { this.tooltip.attr("aria-hidden", "true"); if (this.tooltip.is(':animated')) - this.tooltip.stop().fadeTo("normal", 0); + this.tooltip.stop().fadeTo("normal", 0, function() { + $(this).hide().css("opacity", ""); + }); else this.tooltip.stop().fadeOut(); -- cgit v1.2.3 From 18a526ad78a0b154e6ce6dc430a025bec7fa2ee2 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Wed, 19 May 2010 18:51:38 +0200 Subject: Show tooltip before positioning it to fix scrolling issue, then hide again before animation --- ui/jquery.ui.tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index f64f40248..134e7546a 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -104,9 +104,9 @@ $.widget("ui.tooltip", { this.tooltip.css({ top: 0, left: 0 - }).position($.extend(this.options.position, { + }).show().position($.extend(this.options.position, { of: target - })); + })).hide(); this.tooltip.attr("aria-hidden", "false"); target.attr("aria-describedby", this.tooltip.attr("id")); -- cgit v1.2.3 From 9b9b66d6adb6bf35c358f97605934a7bff8fc146 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Fri, 9 Jul 2010 15:36:06 +0200 Subject: Updated copyright headers to make it clear that you can choose between MIT and GPLv2. Also added a link to http://jquery.org/license. --- ui/jquery.ui.tooltip.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 134e7546a..68d29f05f 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -1,16 +1,16 @@ /* * jQuery UI Tooltip @VERSION * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2010, AUTHORS.txt + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * * http://docs.jquery.com/UI/Tooltip * * Depends: * jquery.ui.core.js * jquery.ui.widget.js - * jquery.ui.position.js + * jquery.ui.position.js */ (function($) { -- cgit v1.2.3 From 52c31650b04056716f71b92b5d8f47ad11699932 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Tue, 20 Jul 2010 14:00:43 +0200 Subject: Tooltip: Updated positioning - let user also customize of-property --- ui/jquery.ui.tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 68d29f05f..caa36b205 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -104,9 +104,9 @@ $.widget("ui.tooltip", { this.tooltip.css({ top: 0, left: 0 - }).show().position($.extend(this.options.position, { + }).show().position( $.extend({ of: target - })).hide(); + }, this.options.position )).hide(); this.tooltip.attr("aria-hidden", "false"); target.attr("aria-describedby", this.tooltip.attr("id")); -- cgit v1.2.3 From 96977edecc134d9212a304a1236e823237e8e274 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Fri, 30 Jul 2010 14:30:43 +0200 Subject: Use pushStack in tooltip's widget method. See #5732 --- tests/unit/tooltip/tooltip_methods.js | 7 +++++++ ui/jquery.ui.tooltip.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 867923dd0..ace1a1288 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -20,4 +20,11 @@ test("open", function() { $(":ui-tooltip").tooltip("destroy"); }); +test("widget", function() { + var tooltip = $("#tooltipped1").tooltip(); + same(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); + same(tooltip.tooltip("widget").end()[0], tooltip[0]); +}); + + })(jQuery); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index caa36b205..32d5afeee 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -70,7 +70,7 @@ $.widget("ui.tooltip", { }, widget: function() { - return this.tooltip; + return this.element.pushStack(this.tooltip.get()); }, open: function(event) { -- cgit v1.2.3 From 732a485676a1dcbefc16fdb9d26774b622410138 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 21 Oct 2010 21:03:48 +0200 Subject: Tooltip: Adding another ajax example to visual testcase. Fixing async response handling (taking IE cached response quirk into account) and simplifying fade animations a ton. --- tests/visual/tooltip/tooltip.html | 21 +++++++++++++++++++++ ui/jquery.ui.tooltip.js | 21 ++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'ui') diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html index 022093bc7..7b931b155 100644 --- a/tests/visual/tooltip/tooltip.html +++ b/tests/visual/tooltip/tooltip.html @@ -44,6 +44,24 @@ return "Loading..."; } }); + // asynchronous content with caching + var content; + $("#ajax2").tooltip({ + content: function(response) { + if (content) { + return content; + } + $.ajax({ + url: "ajaxcontent.php", + cache: false, + success: function(result) { + content = result; + response(result); + } + }); + return "Loading..."; + } + }); // custom position $("#right2").tooltip({ @@ -117,6 +135,9 @@
    gets its content via ajax
    +
    + gets its content via ajax, caches the response +
    span diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 32d5afeee..8341131ca 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -82,9 +82,12 @@ $.widget("ui.tooltip", { this.current = target; this.currentTitle = target.attr("title"); var content = this.options.content.call(target[0], function(response) { - // ignore async responses that come in after the tooltip is already hidden - if (self.current == target) - self._show(event, target, response); + // IE may instantly serve a cached response, need to give it a chance to finish with _show before that + setTimeout(function() { + // ignore async responses that come in after the tooltip is already hidden + if (self.current == target) + self._show(event, target, response); + }, 13); }); if (content) { self._show(event, target, content); @@ -111,10 +114,7 @@ $.widget("ui.tooltip", { this.tooltip.attr("aria-hidden", "false"); target.attr("aria-describedby", this.tooltip.attr("id")); - if (this.tooltip.is(":animated")) - this.tooltip.stop().show().fadeTo("normal", this.opacity); - else - this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); + this.tooltip.stop(false, true).fadeIn(); this._trigger( "open", event ); }, @@ -132,12 +132,7 @@ $.widget("ui.tooltip", { current.removeAttr("aria-describedby"); this.tooltip.attr("aria-hidden", "true"); - if (this.tooltip.is(':animated')) - this.tooltip.stop().fadeTo("normal", 0, function() { - $(this).hide().css("opacity", ""); - }); - else - this.tooltip.stop().fadeOut(); + this.tooltip.stop(false, true).fadeOut(); this._trigger( "close", event ); } -- cgit v1.2.3 From 8b4245ac7e8c746af97059ed3ef1c886bccdb903 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Tue, 26 Oct 2010 14:32:03 +0200 Subject: Tooltip: Removing tooltipClass option; use .tooltip("widget").addClass("whatever") instead --- tests/unit/tooltip/tooltip_defaults.js | 1 - tests/unit/tooltip/tooltip_options.js | 13 ------------- ui/jquery.ui.tooltip.js | 4 +--- 3 files changed, 1 insertion(+), 17 deletions(-) (limited to 'ui') diff --git a/tests/unit/tooltip/tooltip_defaults.js b/tests/unit/tooltip/tooltip_defaults.js index bcdcd4307..c9960d334 100644 --- a/tests/unit/tooltip/tooltip_defaults.js +++ b/tests/unit/tooltip/tooltip_defaults.js @@ -5,7 +5,6 @@ var tooltip_defaults = { disabled: false, content: $.ui.tooltip.prototype.options.content, - tooltipClass: "ui-widget-content", position: { my: "left center", at: "right center", diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index f7abddb8b..41873ab5b 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -37,17 +37,4 @@ test("content: callback string", function() { }); -test("tooltipClass, default", function() { - $("#tooltipped1").tooltip().tooltip("open"); - same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all ui-widget-content"); - $(":ui-tooltip").tooltip("destroy"); -}); -test("tooltipClass, custom", function() { - $("#tooltipped1").tooltip({ - tooltipClass: "pretty fancy" - }).tooltip("open"); - same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all pretty fancy"); - $(":ui-tooltip").tooltip("destroy"); -}); - })(jQuery); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 8341131ca..08d2e616a 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -23,7 +23,6 @@ var increments = 0; $.widget("ui.tooltip", { options: { - tooltipClass: "ui-widget-content", content: function() { return $(this).attr("title"); }, @@ -39,8 +38,7 @@ $.widget("ui.tooltip", { .attr("id", "ui-tooltip-" + increments++) .attr("role", "tooltip") .attr("aria-hidden", "true") - .addClass("ui-tooltip ui-widget ui-corner-all") - .addClass(this.options.tooltipClass) + .addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content") .appendTo(document.body) .hide(); this.tooltipContent = $("
    ") -- cgit v1.2.3 From bd22613af72f66aed2a0849491a6c8b56b06798a Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Tue, 26 Oct 2010 14:40:48 +0200 Subject: Tooltip: Removing application role, should be set on application level --- ui/jquery.ui.tooltip.js | 5 ----- 1 file changed, 5 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 08d2e616a..454cc6901 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -14,11 +14,6 @@ */ (function($) { -// role=application on body required for screenreaders to correctly interpret aria attributes -if( !$(document.body).is('[role]') ){ - $(document.body).attr('role','application'); -} - var increments = 0; $.widget("ui.tooltip", { -- cgit v1.2.3 From 9556eccc0b790fb4e2cf2198696fc115cccdc1ba Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Tue, 26 Oct 2010 14:41:14 +0200 Subject: Tooltip: Update _init to _create --- ui/jquery.ui.tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 454cc6901..91c60d603 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -27,7 +27,7 @@ $.widget("ui.tooltip", { offset: "15 0" } }, - _init: function() { + _create: function() { var self = this; this.tooltip = $("
    ") .attr("id", "ui-tooltip-" + increments++) -- cgit v1.2.3 From 48a5977d3325869abd7b7ba835eb8ac331fd6eb5 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Tue, 26 Oct 2010 17:07:22 +0200 Subject: Tooltip: Implementing event delegation support. --- demos/tooltip/ajax/content1.html | 1 + demos/tooltip/ajax/content2.html | 1 + demos/tooltip/custom-animation.html | 2 +- demos/tooltip/default.html | 2 +- demos/tooltip/delegation-mixbag.html | 73 ++++++++++++++++++++++++++++++++++ demos/tooltip/index.html | 1 + demos/tooltip/tracking.html | 2 +- tests/unit/tooltip/tooltip_defaults.js | 1 + tests/unit/tooltip/tooltip_events.js | 4 +- tests/unit/tooltip/tooltip_options.js | 5 +++ tests/visual/tooltip/tooltip.html | 45 +++++++++++---------- ui/jquery.ui.tooltip.js | 7 ++-- 12 files changed, 116 insertions(+), 28 deletions(-) create mode 100644 demos/tooltip/ajax/content1.html create mode 100644 demos/tooltip/ajax/content2.html create mode 100644 demos/tooltip/delegation-mixbag.html (limited to 'ui') diff --git a/demos/tooltip/ajax/content1.html b/demos/tooltip/ajax/content1.html new file mode 100644 index 000000000..a1401b26d --- /dev/null +++ b/demos/tooltip/ajax/content1.html @@ -0,0 +1 @@ +

    This content was loaded via ajax.

    \ No newline at end of file diff --git a/demos/tooltip/ajax/content2.html b/demos/tooltip/ajax/content2.html new file mode 100644 index 000000000..f4132d731 --- /dev/null +++ b/demos/tooltip/ajax/content2.html @@ -0,0 +1 @@ +

    This other content was loaded via ajax.

    \ No newline at end of file diff --git a/demos/tooltip/custom-animation.html b/demos/tooltip/custom-animation.html index 585360d7c..1353e3b91 100644 --- a/demos/tooltip/custom-animation.html +++ b/demos/tooltip/custom-animation.html @@ -11,7 +11,7 @@ + + + +
    + + + + + +
    +
    This is the footnote, including other elements
    +
    This is the other footnote, including other elements
    +
    +
    + + + +
    + +

    Show how to combine different event delegated tooltips into a single instance, by customizing the items and content options.

    + +
    + + + + + diff --git a/demos/tooltip/index.html b/demos/tooltip/index.html index e55575d4c..6bc9c1e5c 100644 --- a/demos/tooltip/index.html +++ b/demos/tooltip/index.html @@ -13,6 +13,7 @@
  • Forms with tooltips
  • Track the mouse
  • Custom animation
  • +
  • Delegation Mixbag
  • diff --git a/demos/tooltip/tracking.html b/demos/tooltip/tracking.html index 9af4d0d09..286f01209 100644 --- a/demos/tooltip/tracking.html +++ b/demos/tooltip/tracking.html @@ -11,7 +11,7 @@