lib/opal-jquery/event.rb in opal-jquery-0.0.2 vs lib/opal-jquery/event.rb in opal-jquery-0.0.3
- old
+ new
@@ -1,6 +1,11 @@
+# Wraps native jQuery event objects.
class Event < `$.Event`
+ def [](name)
+ `#{self}[name]`
+ end
+
def current_target
`$(#{self}.currentTarget)`
end
alias_native :default_prevented?, :isDefaultPrevented
@@ -17,24 +22,19 @@
alias_native :propagation_stopped?, :propagationStopped
alias_native :stop_propagation, :stopPropagation
- def target
- %x{
- if (#{self}._opalTarget) {
- return #{self}._opalTarget;
- }
+ alias_native :stop_immediate_propagation, :stopImmediatePropagation
- return #{self}._opalTarget = $(#{self}.target);
- }
+ def target
+ `$(#{self}.target)`
end
def type
`#{self}.type`
end
def which
`#{self}.which`
end
end
-