Print Friendly

# Class YAHOO.widget.MenuBarItem

Package: | YAHOO.widget
Class: | MenuBarItem
Extends: | MenuItem
Defined In: | menu.js

Creates an item for a menu bar.

## Public Properties

Property | Defined By
--- | ---
| CHECKED_IMAGE_ALT_TEXT : String | MenuItem
@description String representing the alt text for the image to be used for the checked image. @default "Checked." @final
| CHECKED_IMAGE_PATH : String | MenuItem
@description String representing the path to the image to be used for the checked state. @default "nt/ic/ut/bsc/menuc...
| COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
@description String representing the alt text for the image to be used for the submenu arrow indicator. @default "Col...
| CSS_CLASS_NAME : String | MenuBarItem
@description String representing the CSS class(es) to be applied to the <li> element of the menu bar item. @d...
| DISABLED_CHECKED_IMAGE_ALT_TEXT : String | MenuItem
@description String representing the alt text for the image to be used for the checked image when the item is disable...
| DISABLED_CHECKED_IMAGE_PATH : String | MenuItem
@description String representing the path to the image to be used for the disabled checked state. @default "nt/ic/ut/...
| DISABLED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
@description String representing the alt text for the image to be used for the submenu arrow indicator when the menu ...
| DISABLED_SUBMENU_INDICATOR_IMAGE_PATH : String | MenuBarItem
@description String representing the path to the image to be used for the submenu arrow indicator when the menu bar i...
| EXPANDED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
@description String representing the alt text for the image to be used for the submenu arrow indicator when the subme...
| IMG_ROOT : String | MenuItem
@description String representing the prefix path to use for non-secure images. @default "http://us.i1.yimg.com/us.yim...
| IMG_ROOT_SSL : String | MenuItem
@description String representing the prefix path to use for securely served images. @default "https://a248.e.akamai.n...
| SELECTED_CHECKED_IMAGE_PATH : String | MenuItem
@description String representing the path to the image to be used for the selected checked state. @default "nt/ic/ut/...
| SELECTED_SUBMENU_INDICATOR_IMAGE_PATH : String | MenuBarItem
@description String representing the path to the image to be used for the submenu arrow indicator when the menu bar i...
| SUBMENU_INDICATOR_IMAGE_PATH : String | MenuBarItem
@description String representing the path to the image to be used for the menu bar item's submenu arrow indicator. @d...
| SUBMENU_TYPE : YAHOO.widget.Menu | MenuItem
@description Object representing the type of menu to instantiate and add when parsing the child nodes of the menu ite...
| browser : String | MenuItem
@description String representing the browser.
| configHelpText : String|<a | MenuItem
@config helptext @description String specifying additional instructional text to accompany the text for the nenu item...
| configSubmenu : Menu|String|Object|<a | MenuItem
@config submenu @description Object specifying the submenu to be appended to the menu item. The value can be one of ...
| constructor : YAHOO.widget.MenuItem | MenuItem
@description Object reference to the menu item's constructor function. @default YAHOO.widget.MenuItem
| element : <a | MenuItem
@description Object reference to the menu item's `<li>` element. @default HTMLLIElement
| groupIndex : Number | MenuItem
@description Number indicating the index of the group to which the menu item belongs. @default null
| imageRoot : String | MenuItem
@description String representing the root path for all of the menu item's images.
| index : Number | MenuItem
@description Number indicating the ordinal position of the menu item in its group. @default null
| isSecure : Boolean | MenuItem
@description Boolean representing whether or not the current browsing context is secure (HTTPS).
| parent : YAHOO.widget.Menu | MenuItem
@description Object reference to the menu item's parent menu. @default null
| srcElement : <a | MenuItem
@description Object reference to the HTML element (either <li>, <optgroup> or <option>) used ...
| submenuIndicator : <a | MenuItem
@description Object reference to the <img> element used to create the submenu indicator for the menu item. @d...
| value : Object | MenuItem
@description Object reference to the menu item's value. @default null

## Public Methods

Method | Defined By
--- | ---
| MenuBarItem() | MenuBarItem
| blur() : void | MenuItem
@description Causes the menu item to lose focus and fires the onblur event.
| configChecked(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "checked" configuration property of the menu item changes.
| configDisabled(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "disabled" configuration property of the menu item changes.
| configEmphasis(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "emphasis" configuration property of the menu item changes.
| configHelpText(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "helptext" configuration property of the menu item changes.
| configSelected(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "selected" configuration property of the menu item changes.
| configStrongEmphasis(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "strongemphasis" configuration property of the menu item changes.
| configSubmenu(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "submenu" configuration property of the menu item changes.
| configTarget(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "target" configuration property of the menu item changes.
| configText(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "text" configuration property of the menu item changes.
| configURL(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`) : void | MenuItem
@description Event handler for when the "url" configuration property of the menu item changes.
| destroy() : void | MenuItem
@description Removes the menu item's `<li>` element from its parent `<ul>` element.
| focus() : void | MenuItem
@description Causes the menu item to receive the focus and fires the focus event.
| getNextEnabledSibling() : YAHOO.widget.MenuItem | MenuItem
@description Finds the menu item's next enabled sibling.
| getPreviousEnabledSibling() : YAHOO.widget.MenuItem | MenuItem
@description Finds the menu item's previous enabled sibling.
| init(`String p_oObject`, `, `MenuBarItem``
@description The MenuBarItem class's initialization method. This method is automatically called by the constructor, a...
| initDefaultConfig() : void | MenuItem
@description Initializes an item's configurable properties.
| toString() : String | MenuBarItem
@description Returns a string representing the menu bar item.

## Public Events

Event | Defined By
--- | ---
| blurEvent : () | MenuItem
@description Fires when the menu item loses the input focus.
| clickEvent : () | MenuItem
@description Fires when the user clicks the on the menu item. Passes back the DOM Event object as an argument.
| destroyEvent : () | MenuItem
@description Fires when the menu item's `<li>` element is removed from its parent `<ul>` element.
| focusEvent : () | MenuItem
@description Fires when the menu item receives focus.
| keyDownEvent : () | MenuItem
@description Fires when the user presses a key when the menu item has focus. Passes back the DOM Event object as an ...
| keyPressEvent : () | MenuItem
@description Fires when the user presses an alphanumeric key when the menu item has focus. Passes back the DOM Event...
| keyUpEvent : () | MenuItem
@description Fires when the user releases a key when the menu item has focus. Passes back the DOM Event object as an...
| mouseDownEvent : () | MenuItem
@description Fires when the user mouses down on the menu item. Passes back the DOM Event object as an argument.
| mouseOutEvent : () | MenuItem
@description Fires when the mouse has left the menu item. Passes back the DOM Event object as an argument.
| mouseOverEvent : () | MenuItem
@description Fires when the mouse has entered the menu item. Passes back the DOM Event object as an argument.
| mouseUpEvent : () | MenuItem
@description Fires when the user releases a mouse button while the mouse is over the menu item. Passes back the DOM ...

## Property Details

### CHECKED_IMAGE_ALT_TEXT

`public String CHECKED_IMAGE_ALT_TEXT`
@description String representing the alt text for the image to be used for the checked image. @default "Checked." @final
This property is defined by MenuItem.

### CHECKED_IMAGE_PATH

`public String CHECKED_IMAGE_PATH`
@description String representing the path to the image to be used for the checked state. @default "nt/ic/ut/bsc/menuchk8_nrm_1.gif" @final
This property is defined by MenuItem.

### COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT

`public String COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT`
@description String representing the alt text for the image to be used for the submenu arrow indicator. @default "Collapsed. Click to expand." @final
This property is defined by MenuItem.

### CSS_CLASS_NAME

`public String CSS_CLASS_NAME`
@description String representing the CSS class(es) to be applied to the `<li>` element of the menu bar item. @default "yuimenubaritem" @final
This property is defined by MenuBarItem.

### DISABLED_CHECKED_IMAGE_ALT_TEXT

`public String DISABLED_CHECKED_IMAGE_ALT_TEXT`
@description String representing the alt text for the image to be used for the checked image when the item is disabled. @default "Checked. (Item disabled.)" @final
This property is defined by MenuItem.

### DISABLED_CHECKED_IMAGE_PATH

`public String DISABLED_CHECKED_IMAGE_PATH`
@description String representing the path to the image to be used for the disabled checked state. @default "nt/ic/ut/bsc/menuchk8_dim_1.gif" @final
This property is defined by MenuItem.

### DISABLED_SUBMENU_INDICATOR_ALT_TEXT

`public String DISABLED_SUBMENU_INDICATOR_ALT_TEXT`
@description String representing the alt text for the image to be used for the submenu arrow indicator when the menu item is disabled. @default "Disabled." @final
This property is defined by MenuItem.

### DISABLED_SUBMENU_INDICATOR_IMAGE_PATH

`public String DISABLED_SUBMENU_INDICATOR_IMAGE_PATH`
@description String representing the path to the image to be used for the submenu arrow indicator when the menu bar item is disabled. @default "nt/ic/ut/alt1/menuarodwn8_dim_1.gif" @final
This property is defined by MenuBarItem.

### EXPANDED_SUBMENU_INDICATOR_ALT_TEXT

`public String EXPANDED_SUBMENU_INDICATOR_ALT_TEXT`
@description String representing the alt text for the image to be used for the submenu arrow indicator when the submenu is visible. @default "Expanded. Click to collapse." @final
This property is defined by MenuItem.

### IMG_ROOT

`public String IMG_ROOT`
@description String representing the prefix path to use for non-secure images. @default "http://us.i1.yimg.com/us.yimg.com/i/"
This property is defined by MenuItem.

### IMG_ROOT_SSL

`public String IMG_ROOT_SSL`
@description String representing the prefix path to use for securely served images. @default "https://a248.e.akamai.net/sec.yimg.com/i/"
This property is defined by MenuItem.

### SELECTED_CHECKED_IMAGE_PATH

`public String SELECTED_CHECKED_IMAGE_PATH`
@description String representing the path to the image to be used for the selected checked state. @default "nt/ic/ut/bsc/menuchk8_hov_1.gif" @final
This property is defined by MenuItem.

### SELECTED_SUBMENU_INDICATOR_IMAGE_PATH

`public String SELECTED_SUBMENU_INDICATOR_IMAGE_PATH`
@description String representing the path to the image to be used for the submenu arrow indicator when the menu bar item is selected. @default "nt/ic/ut/alt1/menuarodwn8_hov_1.gif" @final
This property is defined by MenuBarItem.

### SUBMENU_INDICATOR_IMAGE_PATH

`public String SUBMENU_INDICATOR_IMAGE_PATH`
@description String representing the path to the image to be used for the menu bar item's submenu arrow indicator. @default "nt/ic/ut/alt1/menuarodwn8_nrm_1.gif" @final
This property is defined by MenuBarItem.

### SUBMENU_TYPE

`public YAHOO.widget.Menu SUBMENU_TYPE`
@description Object representing the type of menu to instantiate and add when parsing the child nodes of the menu item's source HTML element. @final
This property is defined by MenuItem.

### browser

`public String browser`
@description String representing the browser.
This property is defined by MenuItem.

### configHelpText

`public String|<a configHelpText`
@config helptext @description String specifying additional instructional text to accompany the text for the nenu item. @default null
This property is defined by MenuItem.

### configSubmenu

`public Menu|String|Object|<a configSubmenu`
@config submenu @description Object specifying the submenu to be appended to the menu item. The value can be one of the following:

- Object specifying a Menu instance.
- Object literal specifying the menu to be created. Format: `{ id: [menu id], itemdata: [array of values for items] }`.
- String specifying the id attribute of the `<div>` element of the menu.
- Object specifying the `<div>` element of the menu.

@default null
This property is defined by MenuItem.

### constructor

`public YAHOO.widget.MenuItem constructor`
@description Object reference to the menu item's constructor function. @default YAHOO.widget.MenuItem
This property is defined by MenuItem.

### element

`public <a element`
@description Object reference to the menu item's `<li>` element. @default HTMLLIElement
This property is defined by MenuItem.

### groupIndex

`public Number groupIndex`
@description Number indicating the index of the group to which the menu item belongs. @default null
This property is defined by MenuItem.

### imageRoot

`public String imageRoot`
@description String representing the root path for all of the menu item's images.
This property is defined by MenuItem.

### index

`public Number index`
@description Number indicating the ordinal position of the menu item in its group. @default null
This property is defined by MenuItem.

### isSecure

`public Boolean isSecure`
@description Boolean representing whether or not the current browsing context is secure (HTTPS).
This property is defined by MenuItem.

### parent

`public YAHOO.widget.Menu parent`
@description Object reference to the menu item's parent menu. @default null
This property is defined by MenuItem.

### srcElement

`public <a srcElement`
@description Object reference to the HTML element (either `<li>`, `<optgroup>` or `<option>`) used create the menu item. @default HTMLLIElement|HTMLOptGroupElement|HTMLOptionElement
This property is defined by MenuItem.

### submenuIndicator

`public <a submenuIndicator`
@description Object reference to the `<img>` element used to create the submenu indicator for the menu item. @default HTMLImageElement
This property is defined by MenuItem.

### value

`public Object value`
@description Object reference to the menu item's value. @default null
This property is defined by MenuItem.

## Constructor Details

### MenuBarItem

`public function MenuBarItem()`
Parameters:

- None.

## Method Details

### blur

`public function blur()`
@description Causes the menu item to lose focus and fires the onblur event.
Parameters:

- None.

Returns:

- `void`

This method is defined by MenuItem.

### configChecked

`public function configChecked(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "checked" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configDisabled

`public function configDisabled(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "disabled" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configEmphasis

`public function configEmphasis(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "emphasis" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configHelpText

`public function configHelpText(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "helptext" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configSelected

`public function configSelected(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "selected" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configStrongEmphasis

`public function configStrongEmphasis(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "strongemphasis" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configSubmenu

`public function configSubmenu(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "submenu" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configTarget

`public function configTarget(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "target" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configText

`public function configText(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "text" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### configURL

`public function configURL(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuItem p_oItem`)`
@description Event handler for when the "url" configuration property of the menu item changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oItem` : YAHOO.widget.MenuItem
  Object representing the menu item that fired the event.

Returns:

- `void`

This method is defined by MenuItem.

### destroy

`public function destroy()`
@description Removes the menu item's `<li>` element from its parent `<ul>` element.
Parameters:

- None.

Returns:

- `void`

This method is defined by MenuItem.

### focus

`public function focus()`
@description Causes the menu item to receive the focus and fires the focus event.
Parameters:

- None.

Returns:

- `void`

This method is defined by MenuItem.

### getNextEnabledSibling

`public function getNextEnabledSibling()`
@description Finds the menu item's next enabled sibling.
Parameters:

- None.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by MenuItem.

### getPreviousEnabledSibling

`public function getPreviousEnabledSibling()`
@description Finds the menu item's previous enabled sibling.
Parameters:

- None.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by MenuItem.

### init

`public function init(`String p_oObject`, `, `@description The MenuBarItem class's initialization method. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
Parameters:

- `p_oObject` : String
  String specifying the text of the menu bar item.
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-` : <a
  one-html.html#ID-74680021">HTMLLIElement

} p_oObject Object specifying the `<li>` element of the menu bar item.```
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-` : <a
  one-html.html#ID-38450247">HTMLOptGroupElement} p_oObject Object specifying the `<optgroup>` element of the menu bar item.
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-` : <a
  one-html.html#ID-70901257">HTMLOptionElement} p_oObject Object specifying the `<option>` element of the menu bar item.
- `p_oConfig` : Object
  Optional. Object literal specifying the configuration for the menu bar item. See configuration class documentation for more details.
Returns:

- `void`

This method is defined by MenuBarItem.

### initDefaultConfig

`public function initDefaultConfig()`
@description Initializes an item's configurable properties.
Parameters:

- None.

Returns:

- `void`

This method is defined by MenuItem.

### toString

`public function toString()`
@description Returns a string representing the menu bar item.
Parameters:

- None.

Returns:

- `String`

This method is defined by MenuBarItem.

## Event Details

### blurEvent

`public event blurEvent`
@description Fires when the menu item loses the input focus.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### clickEvent

`public event clickEvent`
@description Fires when the user clicks the on the menu item. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### destroyEvent

`public event destroyEvent`
@description Fires when the menu item's `<li>` element is removed from its parent `<ul>` element.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### focusEvent

`public event focusEvent`
@description Fires when the menu item receives focus.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### keyDownEvent

`public event keyDownEvent`
@description Fires when the user presses a key when the menu item has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### keyPressEvent

`public event keyPressEvent`
@description Fires when the user presses an alphanumeric key when the menu item has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### keyUpEvent

`public event keyUpEvent`
@description Fires when the user releases a key when the menu item has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### mouseDownEvent

`public event mouseDownEvent`
@description Fires when the user mouses down on the menu item. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### mouseOutEvent

`public event mouseOutEvent`
@description Fires when the mouse has left the menu item. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### mouseOverEvent

`public event mouseOverEvent`
@description Fires when the mouse has entered the menu item. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

### mouseUpEvent

`public event mouseUpEvent`
@description Fires when the user releases a mouse button while the mouse is over the menu item. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by MenuItem.

Copyright © 2006 Jack Slocum. All rights reserved.