Class: Dommy::ToggleEvent
Overview
ToggleEvent — fired at a <details> (and other poppable elements) when it
opens/closes, exposing the transition via oldState / newState
("open"/"closed"). A plain Event subclass.
Constant Summary
Constants inherited from Event
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
Instance Attribute Summary
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ ToggleEvent
constructor
A new instance of ToggleEvent.
Methods inherited from Event
#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_run_passive__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Methods included from Bridge::Methods
Constructor Details
#initialize(type, init = nil) ⇒ ToggleEvent
Returns a new instance of ToggleEvent.
685 686 687 688 689 |
# File 'lib/dommy/event.rb', line 685 def initialize(type, init = nil) super @old_state = read_init(init, "oldState").to_s @new_state = read_init(init, "newState").to_s end |
Instance Method Details
#__js_get__(key) ⇒ Object
691 692 693 694 695 696 697 |
# File 'lib/dommy/event.rb', line 691 def __js_get__(key) case key when "oldState" then @old_state when "newState" then @new_state else super end end |