CommentButton

CommentButton

Class representing a comment button, be it a simple link or an OOUI button depending on user settings.

Constructor

new CommentButton(config)

Source:

Create a comment button.

Parameters:
Name Type Description
config object

Button config, see the details at Button.

Properties
Name Type Attributes Description
widgetConstructor function <optional>

Function that creates an OOUI widget that is the original source of this button (for OOUI buttons). It is run when we need to "hydrate" the button that is originally created by cloning a prototype, bringing some original behaviors to it.

Extends

Members

buttonElement :Element

Source:
Overrides:

Button element (an 'a' element by default). It can be the same as the main element or its descendant.

Type:
  • Element

buttonWidget :external:OO.ui.ButtonWidget

Source:

Button's OOUI widget object. Initially OOUI buttons don't have widgets created for them for performance reasons (every other button is just cloned as an element). When their state is changed anyhow, the widget is created.

Type:

element :Element

Source:
Overrides:

Main element. It can be the same as the link element or a wrapper around it.

Type:
  • Element

iconElement :Element|undefined

Source:
Overrides:

Button icon element, a descendant of the link element.

Type:
  • Element | undefined

labelElement :Element

Source:
Overrides:

Button label element. It can be the same as the link element or its descendant.

Type:
  • Element

widgetConstructor :function

Source:

Constructor for the button's OOUI widget (if that's an OOUI button).

Type:
  • function

Methods

hide() → {Button}

Source:
Overrides:

Hide the button.

Returns:

This button.

Type
Button

isDisabled() → {boolean}

Source:
Overrides:

Check whether the button is disabled.

Returns:
Type
boolean

isPending() → {boolean}

Source:
Overrides:

Check whether the button is pending.

Returns:
Type
boolean

(protected) maybeExecuteAction(action, e)

Source:
Overrides:

Execute a pre-defined action if the button is conditions are met.

Parameters:
Name Type Description
action function
e Event

setAction(actionnullable) → {Button}

Source:
Overrides:

Set the action of the button. It will be executed on click or Enter press.

Parameters:
Name Type Attributes Description
action function <nullable>
Returns:

This button.

Type
Button

setDisabled(disabled) → {CommentButton}

Source:
Overrides:

Set the button disabled or not.

Parameters:
Name Type Description
disabled boolean
Returns:

This button.

Type
CommentButton

setHref(href) → {Button}

Source:
Overrides:

Set the href attribute of the button.

Parameters:
Name Type Description
href string
Returns:

This button.

Type
Button

setIconProgressive()

Source:
Overrides:

Set the class to an OOUI icon to make it look like icons with the "progressive" flag do. Somehow OOUI doesn't set it at the building stage.

setLabel(label) → {CommentButton}

Source:
Overrides:

Set the label of the button.

Parameters:
Name Type Description
label string
Returns:

This button.

Type
CommentButton

setPending(pending) → {CommentButton}

Source:
Overrides:

Set the button pending or not.

Parameters:
Name Type Description
pending boolean
Returns:

This button.

Type
CommentButton

setTooltip(tooltip) → {CommentButton}

Source:
Overrides:

Set the tooltip of the button.

Parameters:
Name Type Description
tooltip string
Returns:

This button.

Type
CommentButton

show() → {Button}

Source:
Overrides:

Show the button.

Returns:

This button.

Type
Button

toggle(show) → {Button}

Source:
Overrides:

Show or hide the button, depending on the parameter.

Parameters:
Name Type Description
show boolean

Whether to show the button.

Returns:

This button.

Type
Button