Tooltip
This element is used for the tooltip popups. For text only tooltips, this element doesn't need to be used; instead you may just add a tooltiptext attribute to an element.
More information about tooltip
Attributes:
crop | default | label | noautohide | onpopuphidden |
onpopuphiding | onpopupshowing | onpopupshown | position |
Attributes:
Inherited from XUL Element:
align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
preference-editable
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width
crop
Type: one of the values below
If the label of the tooltip is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
default
Type: boolean
If true, the tooltip is used as the default popup for displaying tooltips in the window.
label
Type: string
The label that will appear on the tooltip. If this is left out, no text appears.
noautohide
Type: boolean
If this attribute is set to false or omitted, the tooltip will automatically disappear after a few seconds. If this attribute is set to true, this will not happen and the tooltip will only hide when the user moves the mouse to another element.
onpopuphidden
Type: script code
This event is sent to a popup after it has been hidden.
onpopuphiding
Type: script code
This event is sent to a popup when it is about to be hidden.
onpopupshowing
Type: script code
This event is sent to a popup just before it is popped open. This handler is usually used to dynamically set the contents when the user requests to display it. Returning false from this event handler prevents the popup from appearing.
onpopupshown
Type: script code
This is event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.
position
Type: one of the values below
The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the menu on one side on a button.
- after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned. This is typically used for drop-down menus.
- after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
- before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
- before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
- end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
- end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
- start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
- start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
- overlap: The popup appears over top of the element with the upper-left corners aligned.
- at_pointer: The popup appears at the same position as the mouse pointer.
- after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element.
Properties and Methods:
Inherited from XUL Element:
align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width
Inherited from Element:
addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName
hidePopup ( )
Return Type: no return value
Closes the tooltip window immediately.
label
Type: string
Gets and sets the value of the label attribute.
moveTo ( x , y )
Return Type: no return value
Moves the popup to a new location.
popupBoxObject
Type: nsIPopupBoxObject
This read-only property holds the nsIPopupBoxObject that implements the tooltip. You wouldn't normally need to use this property as all of its functions are available via the tooltip itself.
position
Type: one of the values below
The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the menu on one side on a button.
- after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned. This is typically used for drop-down menus.
- after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
- before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
- before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
- end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
- end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
- start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
- start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
- overlap: The popup appears over top of the element with the upper-left corners aligned.
- at_pointer: The popup appears at the same position as the mouse pointer.
- after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element.
showPopup ( element, x , y , popupType, anchor, align )
Return Type: no return value
Opens the tooltip. There are two ways of specifying where the tooltip appears, either at a specific screen position, or relative to some element in the window. If either x and y are set to values, the tooltip will appear at the screen coordinate (x,y). If x and y are -1, the tooltip will be positioned relative to the element specified as the first argument. This is the likely case for having a tooltip appear over an element. In this latter case, the anchor and align arguments may be used to further control where the tooltip appears relative to the element. The anchor argument corresponds to the popupanchor attribute on the element. The align argument corresponds to the popupalign attribute on the element. The anchor and align attributes are ignored if either x or y are not -1.
To have a tooltip appear relative to another element yet still be offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element and use those as the x and y arguments offset by the desired values.
Type should be either the string "popup", "context" or "tooltip".
sizeTo ( width , height )
Return Type: no return value
Changes the current size of the popup to a new width and height.