Class: W3C::DOM3::KeyboardEvent
- Inherits:
-
UIEvent
- Object
- W3C::DOM4::Event
- UIEvent
- W3C::DOM3::KeyboardEvent
- Includes:
- KeyLocations
- Defined in:
- lib/w3c/dom3/keyboard_event.rb
Overview
Direct Known Subclasses
Defined Under Namespace
Modules: KeyLocations
Constant Summary
Constants included from KeyLocations
KeyLocations::DOM_KEY_LOCATION_LEFT, KeyLocations::DOM_KEY_LOCATION_NUMPAD, KeyLocations::DOM_KEY_LOCATION_RIGHT, KeyLocations::DOM_KEY_LOCATION_STANDARD
Constants inherited from W3C::DOM4::Event
W3C::DOM4::Event::AT_TARGET, W3C::DOM4::Event::BUBBLING_PHASE, W3C::DOM4::Event::CAPTURING_PHASE, W3C::DOM4::Event::NONE
Instance Method Summary collapse
-
#getModifierState(keyArg) ⇒ TrueClass || FalseClass
Queries the state of a modifier using a key value.
- #initialize(typeArg, keyboardEventInitDict = {}) ⇒ Object constructor
Methods inherited from W3C::DOM4::Event
#preventDefault, #stopImmediatePropagation, #stopPropagation
Constructor Details
#initialize(typeArg, keyboardEventInitDict = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/w3c/dom3/keyboard_event.rb', line 27 def initialize(typeArg, keyboardEventInitDict={}) @key = keyboardEventInitDict[:key] || '' if (not @key.empty?) and keyboardEventInitDict[:code].to_s.empty? raise ArgumentError, "keyboardEventInitDict[:key] has a value while keyboardEventInitDict[:code] is nil" end @code = keyboardEventInitDict[:code] || '' @location = keyboardEventInitDict[:location] || 0 @repeat = keyboardEventInitDict[:repeat] || false @isComposing = keyboardEventInitDict[:isComposing] || false @modifier_state = Hash[DOM3::KeyValues::ModifierKeys.zip([false, !!keyboardEventInitDict[:altKey], !!keyboardEventInitDict[:keyModifierStateAltGraph], !!keyboardEventInitDict[:keyModifierStateCapsLock], !!keyboardEventInitDict[:ctrlKey], !!keyboardEventInitDict[:keyModifierStateFn], !!keyboardEventInitDict[:keyModifierStateFnLock], !!keyboardEventInitDict[:keyModifierStateHyper], !!keyboardEventInitDict[:metaKey], !!keyboardEventInitDict[:keyModifierStateNumLock], !!keyboardEventInitDict[:keyModifierStateOS], !!keyboardEventInitDict[:keyModifierStateScrollLock], !!keyboardEventInitDict[:shiftKey], !!keyboardEventInitDict[:keyModifierStateSuper], !!keyboardEventInitDict[:keyModifierStateSymbol], !!keyboardEventInitDict[:keyModifierStateSymbolLock]])] @modifier_state.default = false super(typeArg, keyboardEventInitDict) end |
Instance Method Details
#getModifierState(keyArg) ⇒ TrueClass || FalseClass
Queries the state of a modifier using a key value.
84 85 86 |
# File 'lib/w3c/dom3/keyboard_event.rb', line 84 def getModifierState(keyArg) !!@modifier_state[keyArg] end |