Home

# Class goog.ui.MenuItemRenderer

Default renderer for {@link goog.ui.MenuItem}s. Each item has the following structure:

    ...(menu item contents)...

extends goog.ui.ControlRenderer

Instance Method Summary
| `createContent(?goog.ui.ControlContent content, ?goog.dom.DomHelper dom) ⇒ ?Element` Wraps the given text caption or existing DOM node(s) in a structural element containing the menu item's contents.
| `createDom(?goog.ui.Control control) ⇒ ?Element` Overrides {@link goog.ui.ControlRenderer#createDom} by adding extra markup and stying to the menu item's element if it is selectable or checkable.
| `decorate(?goog.ui.Control control, ?Element element) ⇒ ?Element` Overrides {@link goog.ui.ControlRenderer#decorate} by initializing the menu item to checkable based on whether the element to be decorated has extra stying indicating that it should be.
| `getAriaRole() ⇒ ?goog.dom.a11y.Role`
| `getClassForState(?goog.ui.Component.State state) ⇒ (string|undefined)` Takes a single {@link goog.ui.Component.State}, and returns the corresponding CSS class name (null if none). Overrides the superclass implementation by using 'highlight' as opposed to 'hover' as the CSS class name suffix for the HOVER state, for backwards compatibility.
| `getCompositeCssClass_(?goog.ui.MenuItemRenderer.CompositeCssClassIndex_ index) ⇒ string` Returns the composite CSS class by using the cached value or by constructing the value from the base CSS class and the passed index.
| `getContentElement(?Element element) ⇒ ?Element` Takes the control's root element and returns the parent element of the control's contents. Since by default controls are rendered as a single DIV, the default implementation returns the element itself. Subclasses with more complex DOM structures must override this method as needed.
| `getCssClass() ⇒ string` Returns the CSS class name to be applied to the root element of all components rendered or decorated using this renderer. The class name is expected to uniquely identify the renderer class, i.e. no two renderer classes are expected to share the same CSS class name.
| `getStateFromClass(string className) ⇒ ?goog.ui.Component.State` Takes a single CSS class name which may represent a component state, and returns the corresponding component state (0x00 if none). Overrides the superclass implementation by treating 'goog-option-selected' as special, for backwards compatibility.
| `hasCheckBoxStructure(?Element element) ⇒ boolean` Determines whether the item contains a checkbox element.
| `hasContentStructure(?Element element) ⇒ boolean` Returns true if the element appears to have a proper menu item structure by checking whether its first child has the appropriate structural class name.
| `setCheckable(?goog.ui.Control item, ?Element element, boolean checkable)` Enables/disables checkbox semantics on the menu item.
| `setContent(?Element element, ?goog.ui.ControlContent content)` Takes a menu item's root element, and sets its content to the given text caption or DOM structure. Overrides the superclass immplementation by making sure that the checkbox structure (for selectable/checkable menu items) is preserved.
| `setEnableCheckBoxStructure(?goog.ui.Control item, ?Element element, boolean enable)` Adds or removes extra markup and CSS styling to the menu item to make it selectable or non-selectable, depending on the value of the {@code selectable} argument.
| `setSelectable(?goog.ui.Control item, ?Element element, boolean selectable)` Enables/disables radio button semantics on the menu item.