Skip to content
gdotdesign edited this page Nov 3, 2014 · 1 revision

When an NODE is created then the instance is saved into their native counterpart, which means when we query or try to create a new instance we get back the original one:

class MyComponent < Fron::Component
  tag 'test'
end
test = MyComponent.new
test >> DOM::Document.body

puts test # #<MyComponent:0001>
puts DOM::Document.body.find('test') # #<MyComponent:0001>

This is the same with events, the target will be the same instance:

...

DOM::Document.body.delegate :click, 'test' do |event|
  puts event.target # #<MyComponent:0001>
end
Clone this wiki locally