Home

# Class goog.ui.Tooltip

Tooltip widget. Can be attached to one or more elements and is shown, with a slight delay, when the the cursor is over the element or the element gains focus.

extends goog.ui.Popup

Instance Method Summary
| `attach((Element|null|string) el)` Attach to element. Tooltip will be displayed when the cursor is over the element or when the element has been active for a few milliseconds.
| `checkForParentTooltip_()` Looks for an active tooltip whose element contains this tooltip's anchor. This allows us to prevent hides until they are really necessary.
| `clearHideTimer()` Helper method called to clear the close timer.
| `clearShowTimer()` Helper method called to clear the show timer.
| `detach((Element|null|string=) opt_el)` Detach from element(s).
| `detachElement_(?Element el)` Detach from element.

`disposeInternal()`

Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:

    MyClass.prototype.disposeInternal = function() {
    MyClass.superClass_.disposeInternal.call(this);
    // Dispose logic for MyClass
    };

| `getActiveElement() ⇒ ?Element`
| `getAnchorFromElement(?Element el) ⇒ ?Element` Find anchor containing the given element, if any.
| `getChildTooltip() ⇒ ?goog.ui.Tooltip`
| `getDomHelper() ⇒ ?goog.dom.DomHelper` Returns the dom helper that is being used on this component.
| `getElements() ⇒ ?goog.structs.Set`
| `getHideDelayMs() ⇒ number`
| `getHtml() ⇒ string`
| `getPositioningStrategy(?goog.ui.Tooltip.Activation activationType) ⇒ !goog.positioning.AbstractPosition` Return a Position instance for repositioning the tooltip. Override in subclasses to customize the way repositioning is done.
| `getShowDelayMs() ⇒ number`
| `getState() ⇒ ?goog.ui.Tooltip.State`
| `getText() ⇒ string`
| `handleFocus(?goog.events.BrowserEvent event)` Handler for focus events.
| `handleMouseMove(?goog.events.BrowserEvent event)` Handler for mouse move events.
| `handleMouseOutAndBlur(?goog.events.BrowserEvent event)` Handler for mouse out and blur events.
| `handleMouseOver(?goog.events.BrowserEvent event)` Handler for mouse over events.
| `handleTooltipMouseOut(?goog.events.BrowserEvent event)` Handler for mouse out events for the tooltip element.
| `handleTooltipMouseOver(?goog.events.BrowserEvent event)` Handler for mouse over events for the tooltip element.
| `hasActiveChild() ⇒ boolean`
| `isCoordinateInTooltip(?goog.math.Coordinate coord) ⇒ boolean` Returns true if the coord is in the tooltip.
| `maybeHide(?Element el)` Called by timer from mouse out handler. Hides tooltip if cursor is still outside element and tooltip, or if a child of tooltip has the focus.
| `maybeShow(?Element el, ?goog.positioning.AbstractPosition= opt_pos)` Called by timer from mouse over handler. Shows tooltip if cursor is still over the same element.
| `onBeforeShow() ⇒ boolean` Called before the popup is shown.
| `onHide_(?Object= opt_target)` Called after the popup is hidden.
| `positionAndShow_(?Element el, ?goog.positioning.AbstractPosition= opt_pos)` Sets tooltip position and shows it.
| `saveCursorPosition_(?goog.events.BrowserEvent event)` Saves the current mouse cursor position to {@code this.cursorPosition}.
| `setActiveElement(?Element activeEl)`
| `setElement(?Element el)` Sets tooltip element.
| `setHideDelayMs(number delay)` Sets delay in milliseconds before tooltip is hidden once the cursor leavs the element.
| `setHtml(string str)` Sets tooltip message as HTML markup.
| `setRequireInteraction(boolean requireInteraction)` Sets whether tooltip requires the mouse to have moved or the anchor receive focus before the tooltip will be shown.
| `setShowDelayMs(number delay)` Sets delay in milliseconds before tooltip is displayed for an element.
| `setText(string str)` Sets tooltip message as plain text.
| `showForElement(?Element el, ?goog.positioning.AbstractPosition= opt_pos)` Shows tooltip for a specific element.
| `startHideTimer()` Helper method called to start the close timer.
| `startShowTimer(?Element el, ?goog.positioning.AbstractPosition= opt_pos)` Helper method, starts timer that calls maybeShow. Parameters are passed to the maybeShow method.