ui.TextareaRenderer Extends goog.ui.ControlRenderer
Renderer for goog.ui.Textareas. Renders and decorates native HTML textarea elements. Since native HTML textareas have built-in support for many features, overrides many expensive (and redundant) superclass methods to be no-ops.

Inheritance

Constructor

goog.ui.TextareaRenderer()

Instance Methods

Public Protected Private
canDecorate(element) boolean
Overrides goog.ui.TextareaRenderer#canDecorate by returning true only if the element is an HTML textarea.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
createDom(textarea) !Element
Returns the textarea's contents wrapped in an HTML textarea element. Sets the textarea's disabled attribute as needed.
Arguments:
textarea : goog.ui.Control
Textarea to render.
Returns: !Element  Root element for the Textarea control (an HTML textarea element).
code »
decorate()
No description.
code »
getAriaRole()
No description.
code »
getCssClass()
No description.
code »
isFocusable()
Textareas are always focusable as long as they are enabled.
code »
setContent()
No description.
code »
setState()
Textareas also expose the DISABLED state in the HTML textarea's disabled attribute.
code »
setUpTextarea_(textarea)
Sets up the textarea control such that it doesn't waste time adding functionality that is already natively supported by browser textareas.
Arguments:
textarea : goog.ui.Control
Textarea control to configure.
code »
canDecorate(element) boolean
Returns true if this renderer can decorate the element, false otherwise. The default implementation always returns true.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
createClassByStateMap_()
Creates the lookup table of states to classes, used during state changes.
code »
createDom(control) Element
Returns the control's contents wrapped in a DIV, with the renderer's own CSS class and additional state-specific classes applied to it.
Arguments:
control : goog.ui.Control
Control to render.
Returns: Element  Root element for the control.
code »
createStateByClassMap_()
Creates the lookup table of classes to states, used during decoration.
code »
decorate(controlelement) Element
Default implementation of decorate for goog.ui.Controls. 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.
Arguments:
control : goog.ui.Control
Control instance to decorate the element.
element : Element
Element to decorate.
Returns: Element  Decorated element.
code »
enableClassName(controlclassNameenable)
Updates the control's DOM by adding or removing the specified class name to/from its root element. May add additional combined classes as needed in IE6 and lower. Because of this, subclasses should use this method when modifying class names on the control's root element.
Arguments:
control : goog.ui.Control | Element
Control instance (or root element) to be updated.
className : string
CSS class name to add or remove.
enable : boolean
Whether to add or remove the class name.
code »
enableExtraClassName(controlclassNameenable)
Updates the control's DOM by adding or removing the specified extra class name to/from its element.
Arguments:
control : goog.ui.Control
Control to be updated.
className : string
CSS class name to add or remove.
enable : boolean
Whether to add or remove the class name.
code »
getAppliedCombinedClassNames_(classesopt_includedClass) !Array.<string>
Returns an array of all the combined class names that should be applied based on the given list of classes. Checks the result of getIe6ClassCombinations for any combinations that have all members contained in classes. If a combination matches, the members are joined with an underscore (in order), and added to the return array. If opt_includedClass is provided, return only the combined classes that have all members contained in classes AND include opt_includedClass as well. opt_includedClass is added to classes as well.
Arguments:
classes : goog.array.ArrayLike.<string>
Array-like thing of classes to return matching combined classes for.
opt_includedClass : ?string=
If provided, get only the combined classes that include this one.
Returns: !Array.<string>  Array of combined class names that should be applied.
code »
getAriaRole() goog.a11y.aria.Role | undefined
Returns the ARIA role to be applied to the control. See http://wiki/Main/ARIA for more info.
Returns: goog.a11y.aria.Role | undefined  ARIA role.
code »
getClassForState(state) string | undefined
Takes a single goog.ui.Component.State, and returns the corresponding CSS class name (null if none).
Arguments:
state : goog.ui.Component.State
Component state.
Returns: string | undefined  CSS class representing the given state (undefined if none).
code »
getClassNames(control) !Array.<string>
Returns all CSS class names applicable to the given control, based on its state. The return value is an array of strings containing
  1. the renderer-specific CSS class returned by #getCssClass, followed by
  2. the structural CSS class returned by getStructuralCssClass (if different from the renderer-specific CSS class), followed by
  3. any state-specific classes returned by #getClassNamesForState, followed by
  4. any extra classes returned by the control's getExtraClassNames method and
  5. for IE6 and lower, additional combined classes from getAppliedCombinedClassNames_.
Since all controls have at least one renderer-specific CSS class name, this method is guaranteed to return an array of at least one element.
Arguments:
control : goog.ui.Control
Control whose CSS classes are to be returned.
Returns: !Array.<string>  Array of CSS class names applicable to the control.
code »
getClassNamesForState(state) !Array.<string>
Takes a bit mask of goog.ui.Component.States, and returns an array of the appropriate class names representing the given state, suitable to be applied to the root element of a component rendered using this renderer, or null if no state-specific classes need to be applied. This default implementation uses the renderer's getClassForState method to generate each state-specific class.
Arguments:
state : number
Bit mask of component states.
Returns: !Array.<string>  Array of CSS class names representing the given state.
code »
getContentElement(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.
Arguments:
element : Element
Root element of the control whose content element is to be returned.
Returns: Element  The control's content element.
code »
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.
Returns: string  Renderer-specific CSS class name.
code »
getIe6ClassCombinations() Array.<Array.<string>>
Returns an array of combinations of classes to apply combined class names for in IE6 and below. See IE6_CLASS_COMBINATIONS for more detail. This method doesn't reference IE6_CLASS_COMBINATIONS so that it can be compiled out, but subclasses should return their IE6_CLASS_COMBINATIONS static constant instead.
Returns: Array.<Array.<string>>  Array of class name combinations.
code »
getKeyEventTarget(control) Element
Returns the element within the component's DOM that should receive keyboard focus (null if none). The default implementation returns the control's root element.
Arguments:
control : goog.ui.Control
Control whose key event target is to be returned.
Returns: Element  The key event target.
code »
getStateFromClass(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).
Arguments:
className : string
CSS class name, possibly representing a component state.
Returns: goog.ui.Component.State  state Component state corresponding to the given CSS class (0x00 if none).
code »
getStructuralCssClass() string
Returns the name of a DOM structure-specific CSS class to be applied to the root element of all components rendered or decorated using this renderer. Unlike the class name returned by #getCssClass, the structural class name may be shared among different renderers that generate similar DOM structures. The structural class name also serves as the basis of derived class names used to identify and style structural elements of the control's DOM, as well as the basis for state-specific class names. The default implementation returns the same class name as #getCssClass, but subclasses are expected to override this method as needed.
Returns: string  DOM structure-specific CSS class name (same as the renderer- specific CSS class name by default).
code »
initializeDom(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 goog.ui.Control#enterDocument.
Arguments:
control : goog.ui.Control
Control whose DOM is to be initialized as it enters the document.
code »
isFocusable(control) boolean
Returns true if the control's key event target supports keyboard focus (based on its tabIndex attribute), false otherwise.
Arguments:
control : goog.ui.Control
Control whose key event target is to be checked.
Returns: boolean  Whether the control's key event target is focusable.
code »
setAllowTextSelection(elementallow)
Allows or disallows text selection within the control's DOM.
Arguments:
element : Element
The control's root element.
allow : boolean
Whether the element should allow text selection.
code »
setAriaRole(elementopt_preferredRole)
Sets the element's ARIA role.
Arguments:
element : Element
Element to update.
opt_preferredRole : ?goog.a11y.aria.Role=
The preferred ARIA role.
code »
setAriaStates(controlelement)
Sets the element's ARIA attributes, including distinguishing between universally supported ARIA properties and ARIA states that are only supported by certain ARIA roles. Only attributes which are initialized to be true will be set.
Arguments:
control : !goog.ui.Control
Control whose ARIA state will be updated.
element : !Element
Element whose ARIA state is to be updated.
code »
setContent(elementcontent)
Takes a control's root element, and sets its content to the given text caption or DOM structure. The default implementation replaces the children of the given element. Renderers that create more complex DOM structures must override this method accordingly.
Arguments:
element : Element
The control's root element.
content : goog.ui.ControlContent
Text caption or DOM structure to be set as the control's content. The DOM nodes will not be cloned, they will only moved under the content element of the control.
code »
setFocusable(controlfocusable)
Updates the control's key event target to make it focusable or non-focusable via its tabIndex attribute. Does nothing if the control doesn't support the FOCUSED state, or if it has no key event target.
Arguments:
control : goog.ui.Control
Control whose key event target is to be updated.
focusable : boolean
Whether to enable keyboard focus support on the control's key event target.
code »
setRightToLeft(elementrightToLeft)
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.
Arguments:
element : Element
The control's root element.
rightToLeft : boolean
Whether the component is rendered right-to-left.
code »
setState(controlstateenable)
Updates the appearance of the control in response to a state change.
Arguments:
control : goog.ui.Control
Control instance to update.
state : goog.ui.Component.State
State to enable or disable.
enable : boolean
Whether the control is entering or exiting the state.
code »
setVisible(elementvisible)
Shows or hides the element.
Arguments:
element : Element
Element to update.
visible : boolean
Whether to show the element.
code »
updateAriaState(elementstateenable)
Updates the element's ARIA (accessibility) attributes , including distinguishing between universally supported ARIA properties and ARIA states that are only supported by certain ARIA roles.
Arguments:
element : Element
Element whose ARIA state is to be updated.
state : goog.ui.Component.State
Component state being enabled or disabled.
enable : boolean
Whether the state is being enabled or disabled.
code »

Instance Properties

constructor :
No description.
Code »
classByState_ :
Map of component states to state-specific structural class names, used when changing the DOM in response to a state change. Precomputed and cached on first use to minimize object allocations and string concatenation.
Code »
stateByClass_ :
Map of state-specific structural class names to component states, used during element decoration. Precomputed and cached on first use to minimize object allocations and string concatenation.
Code »

Static Methods

goog.ui.TextareaRenderer.getInstance()
No description.
code »

Static Properties

goog.ui.TextareaRenderer.CSS_CLASS :
Default CSS class to be applied to the root element of components rendered by this renderer.
Code »
goog.ui.TextareaRenderer.instance_ :
No description.
Code »
goog.ui.TextareaRenderer.superClass_ :
No description.
Code »

Package ui

Package Reference