Module: Dommy::SubmitButtonActivation

Included in:
HTMLButtonElement, HTMLInputElement
Defined in:
lib/dommy/html_elements.rb

Overview

The activation behavior of a submit button: run the owning form's submission algorithm with this button as the submitter. This makes a click — a real user click, a synthesized driver click, or button.click() from JS — on a submit button submit its form (fire a SubmitEvent, then hand navigation to the delegate), with no driver-level special-casing. Mirrors HyperlinkActivation for the form side.

Instance Method Summary collapse

Instance Method Details

#activation_behavior(_event) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/dommy/html_elements.rb', line 132

def activation_behavior(_event)
  return unless __submit_button__?

  # `form` follows the form-owner algorithm (honoring a `form=` attribute) on
  # both input and button, so a form-associated submit button outside its
  # form still submits the right one.
  form&.__run_form_submission__(self)
end

#activation_target?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/dommy/html_elements.rb', line 128

def activation_target?
  __submit_button__?
end