Skip to content

Commit 02bcb91

Browse files
committed
Opal v1.3 compatibility for new super semantics
1 parent e8fca80 commit 02bcb91

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

examples/component/app/application.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "opal"
22
require "console"
3+
require "promise"
34
require "browser/setup/full"
45

56
# Let's test some element before we have been initialized.
@@ -15,7 +16,7 @@ class MyCounter < Browser::DOM::Element::Custom
1516

1617
self.observed_attributes = %w[value]
1718

18-
def initialize
19+
def initialize(node)
1920
super
2021
end
2122

opal/browser/dom/node.rb

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def self.new(value)
3838
end
3939
end
4040

41+
def initialize(node)
42+
raise ArgumentError, "Please ensure that #initialize of #{self.class} accepts one argument" unless node
43+
super
44+
end
45+
4146
# Return true of the other element is the same underlying DOM node.
4247
#
4348
# @return [Boolean]

spec/dom/element/custom_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def create_custom_class(name, observed_attrs = [])
1010
Class.new(Browser::DOM::Element::Custom) do
11-
def initialize
11+
def initialize(node)
1212
super
1313
$scratchpad[:initialized] = true
1414
end

0 commit comments

Comments
 (0)