Class: Dommy::EventTarget::Listener
- Inherits:
-
Struct
- Object
- Struct
- Dommy::EventTarget::Listener
- Defined in:
- lib/dommy/event.rb
Instance Method Summary collapse
-
#capture? ⇒ Boolean
useCapture: a boolean third argument, or
{capture: …}in the options dictionary. -
#event_handler? ⇒ Boolean
True when this listener was registered via an event handler IDL/content attribute (el.onclick = fn / onclick="…"): its return value is processed per the event handler processing algorithm (a false return cancels).
- #once? ⇒ Boolean
-
#passive? ⇒ Boolean
{ passive: true }— the listener promises not to call preventDefault, so the event's preventDefault() is neutralized while it runs.
Instance Method Details
#capture? ⇒ Boolean
useCapture: a boolean third argument, or {capture: …} in the options
dictionary. A capture listener fires in the capturing phase; a non-capture
listener in the bubbling phase (both at the target).
243 244 245 |
# File 'lib/dommy/event.rb', line 243 def capture? EventTarget.capture_flag() end |
#event_handler? ⇒ Boolean
True when this listener was registered via an event handler IDL/content attribute (el.onclick = fn / onclick="…"): its return value is processed per the event handler processing algorithm (a false return cancels).
229 |
# File 'lib/dommy/event.rb', line 229 def event_handler? = event_handler ? true : false |
#once? ⇒ Boolean
231 232 233 234 235 236 237 238 |
# File 'lib/dommy/event.rb', line 231 def once? case when Hash ["once"] || [:once] else false end end |
#passive? ⇒ Boolean
{ passive: true } — the listener promises not to call preventDefault,
so the event's preventDefault() is neutralized while it runs.
249 250 251 252 253 254 255 256 |
# File 'lib/dommy/event.rb', line 249 def passive? case when Hash EventTarget.js_truthy?(.key?("passive") ? ["passive"] : [:passive]) else false end end |