Renderer for {@link goog.ui.Button}s. Renders and decorates native HTML button elements. Since native HTML buttons have built-in support for many features, overrides many expensive (and redundant) superclass methods to be no-ops.
extends goog.ui.ButtonRenderer| Instance Method Summary | |
canDecorate(?Element element) ⇒ booleanOverrides {@link goog.ui.ButtonRenderer#canDecorate} by returning true only if the element is an HTML button. | |
createDom(?goog.ui.Control control) ⇒ ?ElementReturns the button's contents wrapped in a native HTML button element. Sets the button's disabled attribute as needed. | |
decorate(?goog.ui.Control control, ?Element element) ⇒ ?ElementDefault implementation of {@code decorate} for {@link goog.ui.Control}s. Initializes the control's ID, content, and state based on the ID of the element, its child nodes, and its CSS classes, respectively. Returns the element. | |
getAriaRole() ⇒ (goog.dom.a11y.Role|null|undefined)Returns the ARIA role to be applied to buttons. | |
getValue(?Element element) ⇒ (string|undefined)Takes a button's root element, and returns the value associated with it. No-op in the base class. | |
initializeDom(?goog.ui.Control control)Initializes the control's DOM by configuring properties that can only be set after the DOM has entered the document. This implementation sets up BiDi and keyboard focus. Called from {@link goog.ui.Control#enterDocument}. | |
isFocusable(?goog.ui.Control control) ⇒ booleanReturns true if the control's key event target supports keyboard focus (based on its {@code tabIndex} attribute), false otherwise. | |
setAllowTextSelection(?Element element, boolean allow)Allows or disallows text selection within the control's DOM. | |
setFocusable(?goog.ui.Control control, boolean focusable)Updates the control's key event target to make it focusable or non-focusable via its {@code tabIndex} attribute. Does nothing if the control doesn't support the {@code FOCUSED} state, or if it has no key event target. | |
setRightToLeft(?Element element, boolean rightToLeft)Applies special styling to/from the control's element if it is rendered right-to-left, and removes it if it is rendered left-to-right. | |
setState(?goog.ui.Control control, ?goog.ui.Component.State state, boolean enable)Updates the appearance of the control in response to a state change. | |
setUpNativeButton_(?goog.ui.Control button)Sets up the button control such that it doesn't waste time adding functionality that is already natively supported by native browser buttons. | |
setValue(?Element element, string value)Takes a button's root element and a value, and updates the element to reflect the new value. No-op in the base class. | |
updateAriaState(?Element element, ?goog.ui.Component.State state, boolean enable)Updates the button's ARIA (accessibility) state if the button is being treated as a checkbox. | |