Print Friendly

# Class YAHOO.widget.ContextMenuItem

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

Creates an item for a context menu.

## Public Properties

Property | Defined By
--- | ---
| CHECKED_IMAGE_ALT_TEXT : String | MenuItem
String representing the alt text for the image to be used for the checked image.
| CHECKED_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the checked state.
| COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
String representing the alt text for the image to be used for the submenu arrow indicator.
| CSS_CLASS_NAME : String | MenuItem
String representing the CSS class(es) to be applied to the `<li>` element of the menu item.
| DISABLED_CHECKED_IMAGE_ALT_TEXT : String | MenuItem
String representing the alt text for the image to be used for the checked image when the item is disabled.
| DISABLED_CHECKED_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the disabled checked state.
| DISABLED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
String representing the alt text for the image to be used for the submenu arrow indicator when the menu item is disab...
| DISABLED_SUBMENU_INDICATOR_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the submenu arrow indicator when the menu item is disabled.
| EXPANDED_SUBMENU_INDICATOR_ALT_TEXT : String | MenuItem
String representing the alt text for the image to be used for the submenu arrow indicator when the submenu is visible.
| IMG_ROOT : String | MenuItem
String representing the prefix path to use for non-secure images.
| IMG_ROOT_SSL : String | MenuItem
String representing the prefix path to use for securely served images.
| SELECTED_CHECKED_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the selected checked state.
| SELECTED_SUBMENU_INDICATOR_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the submenu arrow indicator when the menu item is selected.
| SUBMENU_INDICATOR_IMAGE_PATH : String | MenuItem
String representing the path to the image to be used for the menu item's submenu arrow indicator.
| SUBMENU_TYPE : YAHOO.widget.Menu | MenuItem
Object representing the type of menu to instantiate and add when parsing the child nodes of the menu item's source HT...
| browser : String | MenuItem
String representing the browser.
| constructor : YAHOO.widget.MenuItem | MenuItem
Object reference to the menu item's constructor function.
| element : <a | MenuItem
Object reference to the menu item's `<li>` element.
| groupIndex : Number | MenuItem
Number indicating the index of the group to which the menu item belongs.
| imageRoot : String | MenuItem
String representing the root path for all of the menu item's images.
| index : Number | MenuItem
Number indicating the ordinal position of the menu item in its group.
| isSecure : Boolean | MenuItem
Boolean representing whether or not the current browsing context is secure (HTTPS).
| parent : YAHOO.widget.Menu | MenuItem
Object reference to the menu item's parent menu.
| srcElement : <a | MenuItem
Object reference to the HTML element (either <li>, <optgroup> or <option>) used create the me...
| submenuIndicator : <a | MenuItem
Object reference to the `<img>` element used to create the submenu indicator for the menu item.
| value : Object | MenuItem
Object reference to the menu item's value.

## Public Methods

Method | Defined By
--- | ---
| ContextMenuItem() | ContextMenuItem
| blur() : void | MenuItem
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
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
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
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
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
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
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
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
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
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
Event handler for when the "url" configuration property of the menu item changes.
| destroy() : void | MenuItem
Removes the menu item's `<li>` element from its parent `<ul>` element.
| focus() : void | MenuItem
Causes the menu item to receive the focus and fires the focus event.
| getNextEnabledSibling() : YAHOO.widget.MenuItem | MenuItem
Finds the menu item's next enabled sibling.
| getPreviousEnabledSibling() : YAHOO.widget.MenuItem | MenuItem
Finds the menu item's previous enabled sibling.
| init(`String p_oObject`, `, `ContextMenuItem``
The ContextMenuItem class's initialization method. This method is automatically called by the constructor, and sets u...
| initDefaultConfig() : void | MenuItem
Initializes an item's configurable properties.
| toString() : String | ContextMenuItem
Returns a string representing the context menu item.

## Public Events

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

## Property Details

### CHECKED_IMAGE_ALT_TEXT

`public String CHECKED_IMAGE_ALT_TEXT`
String representing the alt text for the image to be used for the checked image.
This property is defined by MenuItem.

### CHECKED_IMAGE_PATH

`public String CHECKED_IMAGE_PATH`
String representing the path to the image to be used for the checked state.
This property is defined by MenuItem.

### COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT

`public String COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT`
String representing the alt text for the image to be used for the submenu arrow indicator.
This property is defined by MenuItem.

### CSS_CLASS_NAME

`public String CSS_CLASS_NAME`
String representing the CSS class(es) to be applied to the `<li>` element of the menu item.
This property is defined by MenuItem.

### DISABLED_CHECKED_IMAGE_ALT_TEXT

`public String DISABLED_CHECKED_IMAGE_ALT_TEXT`
String representing the alt text for the image to be used for the checked image when the item is disabled.
This property is defined by MenuItem.

### DISABLED_CHECKED_IMAGE_PATH

`public String DISABLED_CHECKED_IMAGE_PATH`
String representing the path to the image to be used for the disabled checked state.
This property is defined by MenuItem.

### DISABLED_SUBMENU_INDICATOR_ALT_TEXT

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

### DISABLED_SUBMENU_INDICATOR_IMAGE_PATH

`public String DISABLED_SUBMENU_INDICATOR_IMAGE_PATH`
String representing the path to the image to be used for the submenu arrow indicator when the menu item is disabled.
This property is defined by MenuItem.

### EXPANDED_SUBMENU_INDICATOR_ALT_TEXT

`public String EXPANDED_SUBMENU_INDICATOR_ALT_TEXT`
String representing the alt text for the image to be used for the submenu arrow indicator when the submenu is visible.
This property is defined by MenuItem.

### IMG_ROOT

`public String IMG_ROOT`
String representing the prefix path to use for non-secure images.
This property is defined by MenuItem.

### IMG_ROOT_SSL

`public String IMG_ROOT_SSL`
String representing the prefix path to use for securely served images.
This property is defined by MenuItem.

### SELECTED_CHECKED_IMAGE_PATH

`public String SELECTED_CHECKED_IMAGE_PATH`
String representing the path to the image to be used for the selected checked state.
This property is defined by MenuItem.

### SELECTED_SUBMENU_INDICATOR_IMAGE_PATH

`public String SELECTED_SUBMENU_INDICATOR_IMAGE_PATH`
String representing the path to the image to be used for the submenu arrow indicator when the menu item is selected.
This property is defined by MenuItem.

### SUBMENU_INDICATOR_IMAGE_PATH

`public String SUBMENU_INDICATOR_IMAGE_PATH`
String representing the path to the image to be used for the menu item's submenu arrow indicator.
This property is defined by MenuItem.

### SUBMENU_TYPE

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

### browser

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

### constructor

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

### element

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

### groupIndex

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

### imageRoot

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

### index

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

### isSecure

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

### parent

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

### srcElement

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

### submenuIndicator

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

### value

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

## Constructor Details

### ContextMenuItem

`public function ContextMenuItem()`
Parameters:

- None.

## Method Details

### blur

`public function blur()`
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`)`
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`)`
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`)`
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`)`
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`)`
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`)`
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`)`
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`)`
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`)`
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`)`
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()`
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()`
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()`
Finds the menu item's next enabled sibling.
Parameters:

- None.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by MenuItem.

### getPreviousEnabledSibling

`public function getPreviousEnabledSibling()`
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`, `, `The ContextMenuItem 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 context menu 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 context menu 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 context menu 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 context menu item.
- `p_oConfig` : Object
  Optional. Object literal specifying the configuration for the context menu item. See configuration class documentation for more details.
Returns:

- `void`

This method is defined by ContextMenuItem.

### initDefaultConfig

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

- None.

Returns:

- `void`

This method is defined by MenuItem.

### toString

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

- None.

Returns:

- `String`

This method is defined by ContextMenuItem.

## Event Details

### blurEvent

`public event blurEvent`
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`
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`
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`
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`
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`
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`
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`
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`
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`
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`
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.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.