Skip to content

Commit be944b3

Browse files
committed
Comment inherits from CharacterData
1 parent e0bad5c commit be944b3

File tree

2 files changed

+10
-271
lines changed

2 files changed

+10
-271
lines changed

src/DOMAPI/Comment.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DOMAPI/Comment.res

Lines changed: 4 additions & 270 deletions
Original file line numberDiff line numberDiff line change
@@ -1,278 +1,12 @@
11
open DOMAPI
2-
open EventAPI
2+
3+
include CharacterData.Impl({
4+
type t = comment
5+
})
36

47
/**
58
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Comment)
69
*/
710
@new
811
external make: (~data: string=?) => comment = "Comment"
912

10-
external asCharacterData: comment => characterData = "%identity"
11-
external asNode: comment => node = "%identity"
12-
external asEventTarget: comment => eventTarget = "%identity"
13-
/**
14-
Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
15-
16-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
17-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/before)
18-
*/
19-
@send
20-
external before: (comment, node) => unit = "before"
21-
22-
/**
23-
Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
24-
25-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
26-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/before)
27-
*/
28-
@send
29-
external before2: (comment, string) => unit = "before"
30-
31-
/**
32-
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
33-
34-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
35-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
36-
*/
37-
@send
38-
external after: (comment, node) => unit = "after"
39-
40-
/**
41-
Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.
42-
43-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
44-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/after)
45-
*/
46-
@send
47-
external after2: (comment, string) => unit = "after"
48-
49-
/**
50-
Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.
51-
52-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
53-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith)
54-
*/
55-
@send
56-
external replaceWith: (comment, node) => unit = "replaceWith"
57-
58-
/**
59-
Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes.
60-
61-
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
62-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith)
63-
*/
64-
@send
65-
external replaceWith2: (comment, string) => unit = "replaceWith"
66-
67-
/**
68-
Removes node.
69-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/remove)
70-
*/
71-
@send
72-
external remove: comment => unit = "remove"
73-
74-
/**
75-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
76-
77-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
78-
79-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
80-
81-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
82-
83-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
84-
85-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
86-
87-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
88-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
89-
*/
90-
@send
91-
external addEventListener: (
92-
comment,
93-
~type_: eventType,
94-
~callback: eventListener<'event>,
95-
~options: addEventListenerOptions=?,
96-
) => unit = "addEventListener"
97-
98-
/**
99-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
100-
101-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
102-
103-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
104-
105-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
106-
107-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
108-
109-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
110-
111-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
112-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
113-
*/
114-
@send
115-
external addEventListener2: (
116-
comment,
117-
~type_: eventType,
118-
~callback: eventListener<'event>,
119-
~options: bool=?,
120-
) => unit = "addEventListener"
121-
122-
/**
123-
Removes the event listener in target's event listener list with the same type, callback, and options.
124-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
125-
*/
126-
@send
127-
external removeEventListener: (
128-
comment,
129-
~type_: eventType,
130-
~callback: eventListener<'event>,
131-
~options: eventListenerOptions=?,
132-
) => unit = "removeEventListener"
133-
134-
/**
135-
Removes the event listener in target's event listener list with the same type, callback, and options.
136-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
137-
*/
138-
@send
139-
external removeEventListener2: (
140-
comment,
141-
~type_: eventType,
142-
~callback: eventListener<'event>,
143-
~options: bool=?,
144-
) => unit = "removeEventListener"
145-
146-
/**
147-
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
148-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
149-
*/
150-
@send
151-
external dispatchEvent: (comment, event) => bool = "dispatchEvent"
152-
153-
/**
154-
Returns node's root.
155-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/getRootNode)
156-
*/
157-
@send
158-
external getRootNode: (comment, ~options: getRootNodeOptions=?) => node = "getRootNode"
159-
160-
/**
161-
Returns whether node has children.
162-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/hasChildNodes)
163-
*/
164-
@send
165-
external hasChildNodes: comment => bool = "hasChildNodes"
166-
167-
/**
168-
Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
169-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/normalize)
170-
*/
171-
@send
172-
external normalize: comment => unit = "normalize"
173-
174-
/**
175-
Returns a copy of node. If deep is true, the copy also includes the node's descendants.
176-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/cloneNode)
177-
*/
178-
@send
179-
external cloneNode: (comment, ~deep: bool=?) => node = "cloneNode"
180-
181-
/**
182-
Returns whether node and otherNode have the same properties.
183-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/isEqualNode)
184-
*/
185-
@send
186-
external isEqualNode: (comment, node) => bool = "isEqualNode"
187-
188-
/**
189-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/isSameNode)
190-
*/
191-
@send
192-
external isSameNode: (comment, node) => bool = "isSameNode"
193-
194-
/**
195-
Returns a bitmask indicating the position of other relative to node.
196-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/compareDocumentPosition)
197-
*/
198-
@send
199-
external compareDocumentPosition: (comment, node) => int = "compareDocumentPosition"
200-
201-
/**
202-
Returns true if other is an inclusive descendant of node, and false otherwise.
203-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/contains)
204-
*/
205-
@send
206-
external contains: (comment, node) => bool = "contains"
207-
208-
/**
209-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/lookupPrefix)
210-
*/
211-
@send
212-
external lookupPrefix: (comment, string) => string = "lookupPrefix"
213-
214-
/**
215-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/lookupNamespaceURI)
216-
*/
217-
@send
218-
external lookupNamespaceURI: (comment, string) => string = "lookupNamespaceURI"
219-
220-
/**
221-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/isDefaultNamespace)
222-
*/
223-
@send
224-
external isDefaultNamespace: (comment, string) => bool = "isDefaultNamespace"
225-
226-
/**
227-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/insertBefore)
228-
*/
229-
@send
230-
external insertBefore: (comment, 't, ~child: node) => 't = "insertBefore"
231-
232-
/**
233-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/appendChild)
234-
*/
235-
@send
236-
external appendChild: (comment, 't) => 't = "appendChild"
237-
238-
/**
239-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/replaceChild)
240-
*/
241-
@send
242-
external replaceChild: (comment, ~node: node, 't) => 't = "replaceChild"
243-
244-
/**
245-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/removeChild)
246-
*/
247-
@send
248-
external removeChild: (comment, 't) => 't = "removeChild"
249-
250-
/**
251-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/substringData)
252-
*/
253-
@send
254-
external substringData: (comment, ~offset: int, ~count: int) => string = "substringData"
255-
256-
/**
257-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/appendData)
258-
*/
259-
@send
260-
external appendData: (comment, string) => unit = "appendData"
261-
262-
/**
263-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/insertData)
264-
*/
265-
@send
266-
external insertData: (comment, ~offset: int, ~data: string) => unit = "insertData"
267-
268-
/**
269-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/deleteData)
270-
*/
271-
@send
272-
external deleteData: (comment, ~offset: int, ~count: int) => unit = "deleteData"
273-
274-
/**
275-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceData)
276-
*/
277-
@send
278-
external replaceData: (comment, ~offset: int, ~count: int, ~data: string) => unit = "replaceData"

0 commit comments

Comments
 (0)