Constructs a new renderer and sets the CSS class that the renderer will use
as the base CSS class to apply to all elements rendered by that renderer.
An example to use this function using a menu is:
var myCustomRenderer = goog.ui.ContainerRenderer.getCustomRenderer( goog.ui.MenuRenderer, 'my-special-menu'); var newMenu = new goog.ui.Menu(opt_domHelper, myCustomRenderer);Your styles for the menu can now be: .my-special-menu { }instead of .CSS_MY_SPECIAL_MENU .goog-menu { }You would want to use this functionality when you want an instance of a component to have specific styles different than the other components of the same type in your application. This avoids using descendant selectors to apply the specific styles to this component.
Arguments:
Returns:
An instance of the desired renderer with its getCssClass() method overridden to return the supplied custom CSS class name.
|
code » |