File tree 3 files changed +8
-2
lines changed
3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
require "opal"
2
2
require "console"
3
+ require "promise"
3
4
require "browser/setup/full"
4
5
5
6
# Let's test some element before we have been initialized.
@@ -15,7 +16,7 @@ class MyCounter < Browser::DOM::Element::Custom
15
16
16
17
self . observed_attributes = %w[ value ]
17
18
18
- def initialize
19
+ def initialize ( node )
19
20
super
20
21
end
21
22
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ def self.new(value)
38
38
end
39
39
end
40
40
41
+ def initialize ( node )
42
+ raise ArgumentError , "Please ensure that #initialize of #{ self . class } accepts one argument" unless node
43
+ super
44
+ end
45
+
41
46
# Return true of the other element is the same underlying DOM node.
42
47
#
43
48
# @return [Boolean]
Original file line number Diff line number Diff line change 8
8
9
9
def create_custom_class ( name , observed_attrs = [ ] )
10
10
Class . new ( Browser ::DOM ::Element ::Custom ) do
11
- def initialize
11
+ def initialize ( node )
12
12
super
13
13
$scratchpad[ :initialized ] = true
14
14
end
You can’t perform that action at this time.
0 commit comments