dommy 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -38
  3. data/lib/dommy/animation.rb +1 -1
  4. data/lib/dommy/attr.rb +23 -11
  5. data/lib/dommy/backend/nokogiri_adapter.rb +51 -0
  6. data/lib/dommy/backend/nokolexbor_adapter.rb +80 -0
  7. data/lib/dommy/backend.rb +129 -0
  8. data/lib/dommy/blob.rb +2 -2
  9. data/lib/dommy/compression_streams.rb +4 -4
  10. data/lib/dommy/cookie_store.rb +1 -1
  11. data/lib/dommy/crypto.rb +9 -8
  12. data/lib/dommy/css.rb +7 -7
  13. data/lib/dommy/custom_elements.rb +6 -6
  14. data/lib/dommy/document.rb +98 -32
  15. data/lib/dommy/dom_parser.rb +5 -4
  16. data/lib/dommy/element.rb +231 -50
  17. data/lib/dommy/event.rb +61 -25
  18. data/lib/dommy/event_source.rb +8 -8
  19. data/lib/dommy/fetch.rb +14 -6
  20. data/lib/dommy/file_reader.rb +3 -3
  21. data/lib/dommy/form_data.rb +1 -3
  22. data/lib/dommy/history.rb +7 -4
  23. data/lib/dommy/html_collection.rb +4 -4
  24. data/lib/dommy/html_elements.rb +110 -42
  25. data/lib/dommy/internal/css_pseudo_handlers.rb +28 -0
  26. data/lib/dommy/internal/dom_matching.rb +3 -3
  27. data/lib/dommy/internal/node_traversal.rb +1 -1
  28. data/lib/dommy/internal/node_wrapper_cache.rb +23 -12
  29. data/lib/dommy/internal/template_content_registry.rb +6 -6
  30. data/lib/dommy/intersection_observer.rb +2 -2
  31. data/lib/dommy/location.rb +8 -4
  32. data/lib/dommy/media_query_list.rb +3 -3
  33. data/lib/dommy/message_channel.rb +9 -9
  34. data/lib/dommy/mutation_observer.rb +21 -11
  35. data/lib/dommy/navigator.rb +12 -12
  36. data/lib/dommy/node.rb +12 -0
  37. data/lib/dommy/notification.rb +3 -3
  38. data/lib/dommy/parser.rb +13 -13
  39. data/lib/dommy/performance_observer.rb +2 -2
  40. data/lib/dommy/range.rb +2 -2
  41. data/lib/dommy/resize_observer.rb +2 -2
  42. data/lib/dommy/shadow_root.rb +10 -8
  43. data/lib/dommy/streams.rb +22 -22
  44. data/lib/dommy/text_codec.rb +4 -4
  45. data/lib/dommy/tree_walker.rb +21 -21
  46. data/lib/dommy/url.rb +25 -8
  47. data/lib/dommy/version.rb +1 -1
  48. data/lib/dommy/web_socket.rb +13 -13
  49. data/lib/dommy/window.rb +14 -1
  50. data/lib/dommy/worker.rb +5 -5
  51. data/lib/dommy/xml_http_request.rb +19 -4
  52. data/lib/dommy.rb +12 -2
  53. metadata +12 -26
@@ -4,7 +4,7 @@ module Dommy
4
4
  # `MediaQueryList` — what `window.matchMedia(query)` returns.
5
5
  #
6
6
  # Dommy has no layout / viewport, so `matches` is `false` by default.
7
- # Tests drive media query changes via `__set_matches__(bool)`, which
7
+ # Tests drive media query changes via `__test_set_matches__(bool)`, which
8
8
  # flips the boolean and fires a `change` event — exactly the surface
9
9
  # libraries like Material-UI / Bootstrap / @testing-library consult.
10
10
  #
@@ -42,7 +42,7 @@ module Dommy
42
42
 
43
43
  # Test seam: flip the match state and dispatch a `change` event so
44
44
  # subscribers re-render.
45
- def __set_matches__(value)
45
+ def __test_set_matches__(value)
46
46
  return if @matches == !!value
47
47
 
48
48
  @matches = !!value
@@ -89,7 +89,7 @@ module Dommy
89
89
  end
90
90
  end
91
91
 
92
- def __event_parent__
92
+ def __internal_event_parent__
93
93
  nil
94
94
  end
95
95
  end
@@ -12,8 +12,8 @@ module Dommy
12
12
  def initialize(window)
13
13
  @port1 = MessagePort.new(window)
14
14
  @port2 = MessagePort.new(window)
15
- @port1.__entangle__(@port2)
16
- @port2.__entangle__(@port1)
15
+ @port1.__internal_entangle__(@port2)
16
+ @port2.__internal_entangle__(@port1)
17
17
  end
18
18
 
19
19
  def __js_get__(key)
@@ -39,7 +39,7 @@ module Dommy
39
39
  @pending = []
40
40
  end
41
41
 
42
- def __entangle__(other)
42
+ def __internal_entangle__(other)
43
43
  @entangled = other
44
44
  end
45
45
 
@@ -50,10 +50,10 @@ module Dommy
50
50
  @window.scheduler.queue_microtask(
51
51
  proc do
52
52
  evt = MessageEvent.new("message", "data" => Dommy.structured_clone(data))
53
- if port.__started__?
53
+ if port.__internal_started?
54
54
  port.dispatch_event(evt)
55
55
  else
56
- port.__enqueue__(evt)
56
+ port.__internal_enqueue__(evt)
57
57
  end
58
58
  end
59
59
  )
@@ -76,11 +76,11 @@ module Dommy
76
76
  nil
77
77
  end
78
78
 
79
- def __started__?
79
+ def __internal_started?
80
80
  @started || !@inline_message_handler.nil?
81
81
  end
82
82
 
83
- def __enqueue__(event)
83
+ def __internal_enqueue__(event)
84
84
  @pending << event
85
85
  end
86
86
 
@@ -122,7 +122,7 @@ module Dommy
122
122
  end
123
123
  end
124
124
 
125
- def __event_parent__
125
+ def __internal_event_parent__
126
126
  nil
127
127
  end
128
128
  end
@@ -242,7 +242,7 @@ module Dommy
242
242
  end
243
243
  end
244
244
 
245
- def __event_parent__
245
+ def __internal_event_parent__
246
246
  nil
247
247
  end
248
248
  end
@@ -148,17 +148,27 @@ module Dommy
148
148
  raise TypeError, "MutationObserver.observe: at least one of childList, attributes, characterData must be true"
149
149
  end
150
150
 
151
- @observed <<
152
- {
153
- target: target,
154
- child_list: child_list_on,
155
- subtree: truthy_option(opts, "subtree"),
156
- attributes: attributes_on,
157
- attribute_filter: attribute_filter,
158
- attribute_old_value: truthy_option(opts, "attributeOldValue"),
159
- character_data: character_data_on,
160
- character_data_old_value: truthy_option(opts, "characterDataOldValue")
161
- }
151
+ entry = {
152
+ target: target,
153
+ child_list: child_list_on,
154
+ subtree: truthy_option(opts, "subtree"),
155
+ attributes: attributes_on,
156
+ attribute_filter: attribute_filter,
157
+ attribute_old_value: truthy_option(opts, "attributeOldValue"),
158
+ character_data: character_data_on,
159
+ character_data_old_value: truthy_option(opts, "characterDataOldValue")
160
+ }
161
+
162
+ # WHATWG MutationObserver §observe: if `target` is already
163
+ # observed, replace the existing registration's options
164
+ # (don't merge or stack).
165
+ existing_index = @observed.index { |e| e[:target].equal?(target) }
166
+ if existing_index
167
+ @observed[existing_index] = entry
168
+ else
169
+ @observed << entry
170
+ end
171
+
162
172
  @document.register_observer(self)
163
173
  nil
164
174
  end
@@ -31,7 +31,7 @@ module Dommy
31
31
  attr_reader :clipboard, :permissions, :geolocation, :wake_lock, :locks, :storage
32
32
 
33
33
  # Web Share API. Returns a Promise; tests can inspect
34
- # `__last_shared__` to verify what was offered.
34
+ # `__test_last_shared__` to verify what was offered.
35
35
  def share(data = nil)
36
36
  @last_shared = data
37
37
  PromiseValue.resolve(@window, nil)
@@ -51,11 +51,11 @@ module Dommy
51
51
  true
52
52
  end
53
53
 
54
- def __vibration_log__
54
+ def __test_vibration_log__
55
55
  @vibration_log.dup
56
56
  end
57
57
 
58
- def __last_shared__
58
+ def __test_last_shared__
59
59
  @last_shared
60
60
  end
61
61
 
@@ -193,7 +193,7 @@ module Dommy
193
193
  end
194
194
  end
195
195
 
196
- def __event_parent__
196
+ def __internal_event_parent__
197
197
  nil
198
198
  end
199
199
  end
@@ -237,7 +237,7 @@ module Dommy
237
237
  @overrides[key] = state.to_s
238
238
  @statuses ||= {}
239
239
  status = @statuses[key]
240
- status&.__set_state__(state.to_s)
240
+ status&.__internal_set_state__(state.to_s)
241
241
  nil
242
242
  end
243
243
 
@@ -286,7 +286,7 @@ module Dommy
286
286
  @onchange = nil
287
287
  end
288
288
 
289
- def __set_state__(new_state)
289
+ def __internal_set_state__(new_state)
290
290
  return if @state == new_state
291
291
 
292
292
  @state = new_state
@@ -327,14 +327,14 @@ module Dommy
327
327
  end
328
328
  end
329
329
 
330
- def __event_parent__
330
+ def __internal_event_parent__
331
331
  nil
332
332
  end
333
333
  end
334
334
 
335
335
  # `navigator.geolocation` — stub Geolocation API. Real implementations
336
336
  # query the OS; dommy holds a mock position tests configure via
337
- # `__set_position__(coords)` or `__set_error__(error_code)`.
337
+ # `__test_set_position__(coords)` or `__test_set_error__(error_code)`.
338
338
  #
339
339
  # Spec: https://www.w3.org/TR/geolocation/
340
340
  class Geolocation
@@ -357,7 +357,7 @@ module Dommy
357
357
  end
358
358
 
359
359
  # Test seam: install a mock position.
360
- def __set_position__(coords = {})
360
+ def __test_set_position__(coords = {})
361
361
  merged = DEFAULT_COORDS.merge(coords.transform_keys(&:to_s))
362
362
  @position = {"coords" => merged, "timestamp" => @window.scheduler.now_ms}
363
363
  @error = nil
@@ -365,7 +365,7 @@ module Dommy
365
365
 
366
366
  # Test seam: install a permission/positioning error (code 1=PERMISSION_DENIED,
367
367
  # 2=POSITION_UNAVAILABLE, 3=TIMEOUT).
368
- def __set_error__(code, message = "")
368
+ def __test_set_error__(code, message = "")
369
369
  @position = nil
370
370
  @error = {"code" => code.to_i, "message" => message.to_s}
371
371
  end
@@ -486,7 +486,7 @@ module Dommy
486
486
  end
487
487
  end
488
488
 
489
- def __event_parent__
489
+ def __internal_event_parent__
490
490
  nil
491
491
  end
492
492
  end
@@ -518,7 +518,7 @@ module Dommy
518
518
  end
519
519
  end
520
520
 
521
- def __event_parent__
521
+ def __internal_event_parent__
522
522
  nil
523
523
  end
524
524
  end
data/lib/dommy/node.rb CHANGED
@@ -10,6 +10,12 @@ module Dommy
10
10
  # snapshots tree state at the time of the query, matching what
11
11
  # most happy-dom test patterns expect.
12
12
  class NodeList < Array
13
+ # Methods routed through __js_call__ (keep in sync with its when-arms).
14
+ JS_METHOD_NAMES = %w[item forEach entries keys values].freeze
15
+ def __js_method_names__
16
+ JS_METHOD_NAMES
17
+ end
18
+
13
19
  # Spec-compliant: out-of-range returns nil, not raise (Array#[] is
14
20
  # close but we make negative indices fail too — DOM `item(-1)` is
15
21
  # nil, not Array#[-1]'s last element).
@@ -88,6 +94,12 @@ module Dommy
88
94
  class LiveNodeList
89
95
  include Enumerable
90
96
 
97
+ # Methods routed through __js_call__ (keep in sync with its when-arms).
98
+ JS_METHOD_NAMES = %w[item forEach entries keys values].freeze
99
+ def __js_method_names__
100
+ JS_METHOD_NAMES
101
+ end
102
+
91
103
  def initialize(&block)
92
104
  @compute = block
93
105
  end
@@ -3,7 +3,7 @@
3
3
  module Dommy
4
4
  # `Notification` polyfill. Real browsers prompt the user; dommy
5
5
  # exposes the permission state as a class-level slot tests can
6
- # toggle via `Notification.__set_permission__("granted")`.
6
+ # toggle via `Notification.__test_set_permission__("granted")`.
7
7
  #
8
8
  # Spec: https://notifications.spec.whatwg.org/
9
9
  class Notification
@@ -14,7 +14,7 @@ module Dommy
14
14
  class << self
15
15
  attr_reader :permission
16
16
 
17
- def __set_permission__(value)
17
+ def __test_set_permission__(value)
18
18
  @permission = value.to_s
19
19
  end
20
20
 
@@ -82,7 +82,7 @@ module Dommy
82
82
  end
83
83
  end
84
84
 
85
- def __event_parent__
85
+ def __internal_event_parent__
86
86
  nil
87
87
  end
88
88
  end
data/lib/dommy/parser.rb CHANGED
@@ -1,28 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "nokogiri"
4
-
5
3
  module Dommy
6
- # Thin wrapper around Nokogiri's HTML5 fragment parser. Pinned to
7
- # `max_errors: 0` for silent recovery on malformed HTML (matching
8
- # browser behavior).
4
+ # Thin wrapper around the backend's HTML5 fragment parser. Delegates
5
+ # to `Dommy::Backend.fragment` so backends can supply their own
6
+ # implementation.
9
7
  #
10
- # Known quirks: `<table>`-only fragments wrap children in an
11
- # implicit `<tbody>`; `<select>` reparents non-option children
12
- # outside itself.
8
+ # Known quirks (vary by backend):
9
+ # - Nokogiri (libxml2): `<table>`-only fragments wrap children in
10
+ # an implicit `<tbody>`; `<select>` reparents non-option children.
11
+ # - Nokolexbor (Lexbor): similar behavior, slightly different edge
12
+ # cases for malformed input.
13
13
  #
14
14
  # `owner_doc` is critical: when a node parsed via a detached
15
15
  # fragment gets `add_child`'d into a Document with a different
16
- # Nokogiri owner, libxml2 silently **copies** the node (new
17
- # object_id) instead of moving it. That breaks identity-dependent
18
- # caches (e.g. `Document#wrap_node` and any reconciler that keys
19
- # off node identity). Always pass the destination document.
16
+ # owner, libxml2 silently **copies** the node (new object_id)
17
+ # instead of moving it. That breaks identity-dependent caches
18
+ # (e.g. `Document#wrap_node` and any reconciler that keys off
19
+ # node identity). Always pass the destination document.
20
20
  module Parser
21
21
  def self.fragment(html, owner_doc: nil)
22
22
  if owner_doc
23
23
  owner_doc.fragment(html.to_s)
24
24
  else
25
- Nokogiri::HTML5.fragment(html.to_s, max_errors: 0)
25
+ Backend.fragment(html.to_s, owner_doc: nil)
26
26
  end
27
27
  end
28
28
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Dommy
4
4
  # `PerformanceObserver` — stub. Same observe/disconnect shape, with
5
- # `__trigger__` for tests.
5
+ # `__test_trigger__` for tests.
6
6
  #
7
7
  # Spec: https://w3c.github.io/performance-timeline/
8
8
  class PerformanceObserver
@@ -37,7 +37,7 @@ module Dommy
37
37
  @entry_types.dup
38
38
  end
39
39
 
40
- def __trigger__(entries)
40
+ def __test_trigger__(entries)
41
41
  invoke_callback(entries)
42
42
  end
43
43
 
data/lib/dommy/range.rb CHANGED
@@ -142,8 +142,8 @@ module Dommy
142
142
  collect_nodes_in_range.each do |node|
143
143
  if node.respond_to?(:remove)
144
144
  node.remove
145
- elsif node.respond_to?(:__node__)
146
- node.__node__.unlink
145
+ elsif node.respond_to?(:__dommy_backend_node__)
146
+ node.__dommy_backend_node__.unlink
147
147
  end
148
148
  end
149
149
 
@@ -3,7 +3,7 @@
3
3
  module Dommy
4
4
  # `ResizeObserver` — stub for the element-resize API. Same shape as
5
5
  # IntersectionObserver: observe / unobserve / disconnect, plus
6
- # `__trigger__` for tests to drive callbacks.
6
+ # `__test_trigger__` for tests to drive callbacks.
7
7
  #
8
8
  # Spec: https://drafts.csswg.org/resize-observer/
9
9
  class ResizeObserver
@@ -35,7 +35,7 @@ module Dommy
35
35
  @targets.dup
36
36
  end
37
37
 
38
- def __trigger__(entries)
38
+ def __test_trigger__(entries)
39
39
  invoke_callback(entries)
40
40
  end
41
41
 
@@ -14,7 +14,9 @@ module Dommy
14
14
  include EventTarget
15
15
  include Node
16
16
 
17
- attr_reader :__node__, :host, :mode, :delegates_focus, :slot_assignment, :document
17
+ attr_reader :host, :mode, :delegates_focus, :slot_assignment, :document
18
+
19
+ def __dommy_backend_node__ = @__node__
18
20
 
19
21
  def initialize(host, mode:, delegates_focus: false, slot_assignment: "named")
20
22
  @host = host
@@ -23,7 +25,7 @@ module Dommy
23
25
  @slot_assignment = slot_assignment.to_s
24
26
  @document = host.document
25
27
  @__node__ = @document.nokogiri_doc.fragment("")
26
- @document.__register_shadow_fragment__(@__node__, self)
28
+ @document.__internal_register_shadow_fragment__(@__node__, self)
27
29
  end
28
30
 
29
31
  # ---- Public Ruby API (ParentNode + DocumentFragment mixin) ----
@@ -48,7 +50,7 @@ module Dommy
48
50
 
49
51
  def text_content=(value)
50
52
  @__node__.children.each(&:unlink)
51
- @__node__.add_child(Nokogiri::XML::Text.new(value.to_s, @document.nokogiri_doc))
53
+ @__node__.add_child(Backend.create_text(value.to_s, @document.nokogiri_doc))
52
54
  end
53
55
 
54
56
  def children
@@ -140,9 +142,9 @@ module Dommy
140
142
  end
141
143
 
142
144
  def contains?(other)
143
- return false unless other.respond_to?(:__node__)
145
+ return false unless other.respond_to?(:__dommy_backend_node__)
144
146
 
145
- other_node = other.__node__
147
+ other_node = other.__dommy_backend_node__
146
148
  return true if other_node == @__node__
147
149
 
148
150
  Internal::NodeTraversal.ancestor_of?(@__node__, other_node)
@@ -233,7 +235,7 @@ module Dommy
233
235
  # Event bubbling stops at the ShadowRoot unless event has
234
236
  # `composed: true`. The host is the bubble-path successor when
235
237
  # composition crosses the boundary (handled in Event dispatch).
236
- def __event_parent__
238
+ def __internal_event_parent__
237
239
  nil
238
240
  end
239
241
 
@@ -242,9 +244,9 @@ module Dommy
242
244
  def detach_dom_nodes(value)
243
245
  case value
244
246
  when String
245
- [Nokogiri::XML::Text.new(value, @document.nokogiri_doc)]
247
+ [Backend.create_text(value, @document.nokogiri_doc)]
246
248
  else
247
- node = value.respond_to?(:__node__) ? value.__node__ : nil
249
+ node = value.respond_to?(:__dommy_backend_node__) ? value.__dommy_backend_node__ : nil
248
250
  return [] unless node
249
251
 
250
252
  node.unlink if node.parent
data/lib/dommy/streams.rb CHANGED
@@ -51,7 +51,7 @@ module Dommy
51
51
  end
52
52
 
53
53
  # Convenience: iterate all chunks synchronously into an Array.
54
- def __drain__
54
+ def __internal_drain__
55
55
  out = []
56
56
  until @queue.empty?
57
57
  out << @queue.shift
@@ -60,25 +60,25 @@ module Dommy
60
60
  out
61
61
  end
62
62
 
63
- def __enqueue__(chunk)
63
+ def __internal_enqueue__(chunk)
64
64
  raise Error, "stream is not readable" unless @state == :readable
65
65
 
66
66
  @queue << chunk
67
67
  flush_pending_reads
68
68
  end
69
69
 
70
- def __close__
70
+ def __internal_close__
71
71
  @state = :closed
72
72
  flush_pending_reads
73
73
  end
74
74
 
75
- def __error__(reason)
75
+ def __internal_error__(reason)
76
76
  @state = :errored
77
77
  @error_reason = reason
78
78
  flush_pending_reads
79
79
  end
80
80
 
81
- def __read__
81
+ def __internal_read__
82
82
  promise = PromiseValue.new(@window)
83
83
 
84
84
  if !@queue.empty?
@@ -147,15 +147,15 @@ module Dommy
147
147
  end
148
148
 
149
149
  def enqueue(chunk)
150
- @stream.__enqueue__(chunk)
150
+ @stream.__internal_enqueue__(chunk)
151
151
  end
152
152
 
153
153
  def close
154
- @stream.__close__
154
+ @stream.__internal_close__
155
155
  end
156
156
 
157
157
  def error(reason)
158
- @stream.__error__(reason)
158
+ @stream.__internal_error__(reason)
159
159
  end
160
160
 
161
161
  def __js_call__(method, args)
@@ -177,7 +177,7 @@ module Dommy
177
177
  end
178
178
 
179
179
  def read
180
- @stream.__read__
180
+ @stream.__internal_read__
181
181
  end
182
182
 
183
183
  def release_lock
@@ -227,18 +227,18 @@ module Dommy
227
227
  !@writer.nil?
228
228
  end
229
229
 
230
- def __write__(chunk)
230
+ def __internal_write__(chunk)
231
231
  invoke(@sink["write"], [chunk])
232
232
  PromiseValue.resolve(@window, nil)
233
233
  end
234
234
 
235
- def __close__
235
+ def __internal_close__
236
236
  @state = :closed
237
237
  invoke(@sink["close"], [])
238
238
  PromiseValue.resolve(@window, nil)
239
239
  end
240
240
 
241
- def __abort__(reason)
241
+ def __internal_abort__(reason)
242
242
  @state = :errored
243
243
  invoke(@sink["abort"], [reason])
244
244
  PromiseValue.resolve(@window, nil)
@@ -256,9 +256,9 @@ module Dommy
256
256
  when "getWriter"
257
257
  get_writer
258
258
  when "close"
259
- __close__
259
+ __internal_close__
260
260
  when "abort"
261
- __abort__(args[0])
261
+ __internal_abort__(args[0])
262
262
  end
263
263
  end
264
264
 
@@ -284,15 +284,15 @@ module Dommy
284
284
  end
285
285
 
286
286
  def write(chunk)
287
- @stream.__write__(chunk)
287
+ @stream.__internal_write__(chunk)
288
288
  end
289
289
 
290
290
  def close
291
- @stream.__close__
291
+ @stream.__internal_close__
292
292
  end
293
293
 
294
294
  def abort(reason = nil)
295
- @stream.__abort__(reason)
295
+ @stream.__internal_abort__(reason)
296
296
  end
297
297
 
298
298
  def __js_call__(method, args)
@@ -331,8 +331,8 @@ module Dommy
331
331
  controller.enqueue(chunk)
332
332
  end
333
333
  end,
334
- "close" => proc { @readable.__close__ },
335
- "abort" => proc { |reason| @readable.__error__(reason) }
334
+ "close" => proc { @readable.__internal_close__ },
335
+ "abort" => proc { |reason| @readable.__internal_error__(reason) }
336
336
  }
337
337
  )
338
338
 
@@ -361,15 +361,15 @@ module Dommy
361
361
  end
362
362
 
363
363
  def enqueue(chunk)
364
- @readable.__enqueue__(chunk)
364
+ @readable.__internal_enqueue__(chunk)
365
365
  end
366
366
 
367
367
  def terminate
368
- @readable.__close__
368
+ @readable.__internal_close__
369
369
  end
370
370
 
371
371
  def error(reason)
372
- @readable.__error__(reason)
372
+ @readable.__internal_error__(reason)
373
373
  end
374
374
 
375
375
  def __js_call__(method, args)
@@ -118,8 +118,8 @@ module Dommy
118
118
  window,
119
119
  {
120
120
  "write" => proc { |chunk| controller.enqueue(encoder.encode(chunk)) },
121
- "close" => proc { @readable.__close__ },
122
- "abort" => proc { |r| @readable.__error__(r) }
121
+ "close" => proc { @readable.__internal_close__ },
122
+ "abort" => proc { |r| @readable.__internal_error__(r) }
123
123
  }
124
124
  )
125
125
  end
@@ -155,8 +155,8 @@ module Dommy
155
155
  window,
156
156
  {
157
157
  "write" => proc { |chunk| controller.enqueue(decoder.decode(chunk)) },
158
- "close" => proc { @readable.__close__ },
159
- "abort" => proc { |r| @readable.__error__(r) }
158
+ "close" => proc { @readable.__internal_close__ },
159
+ "abort" => proc { |r| @readable.__internal_error__(r) }
160
160
  }
161
161
  )
162
162
  end