Skip to content

Commit bea1b18

Browse files
committed
split out element into sub modules
1 parent bd0ebf4 commit bea1b18

4 files changed

Lines changed: 388 additions & 3 deletions

File tree

src/Base/Base.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
type element
1+
type element = Base__Element.element

src/Base/Base__Element.res

Lines changed: 385 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,385 @@
1+
@@warning("-30")
2+
3+
type document
4+
type node
5+
type htmlElement
6+
type nodeList<'tNode>
7+
type domTokenList
8+
type namedNodeMap
9+
type shadowRoot
10+
type htmlCollection<'t>
11+
type htmlSlotElement
12+
13+
/**
14+
Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.
15+
[See Element on MDN](https://developer.mozilla.org/docs/Web/API/Element)
16+
TODO: mark as private once mutating fields of private records is allowed
17+
*/
18+
@editor.completeFrom(DOM.Element)
19+
type rec element = {
20+
// Base properties from Node
21+
/**
22+
Returns the type of node.
23+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeType)
24+
*/
25+
nodeType: int,
26+
/**
27+
Returns a string appropriate for the type of node.
28+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
29+
*/
30+
nodeName: string,
31+
/**
32+
Returns node's node document's document base URL.
33+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/baseURI)
34+
*/
35+
baseURI: string,
36+
/**
37+
Returns true if node is connected and false otherwise.
38+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/isConnected)
39+
*/
40+
isConnected: bool,
41+
/**
42+
Returns the node document. Returns null for documents.
43+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/ownerDocument)
44+
*/
45+
ownerDocument: Null.t<document>,
46+
/**
47+
Returns the parent.
48+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/parentNode)
49+
*/
50+
parentNode: Null.t<node>,
51+
/**
52+
Returns the parent element.
53+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/parentElement)
54+
*/
55+
parentElement: Null.t<htmlElement>,
56+
/**
57+
Returns the children.
58+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/childNodes)
59+
*/
60+
childNodes: nodeList<node>,
61+
/**
62+
Returns the first child.
63+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/firstChild)
64+
*/
65+
firstChild: Null.t<node>,
66+
/**
67+
Returns the last child.
68+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/lastChild)
69+
*/
70+
lastChild: Null.t<node>,
71+
/**
72+
Returns the previous sibling.
73+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/previousSibling)
74+
*/
75+
previousSibling: Null.t<node>,
76+
/**
77+
Returns the next sibling.
78+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)
79+
*/
80+
nextSibling: Null.t<node>,
81+
/**
82+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeValue)
83+
*/
84+
mutable nodeValue: Null.t<string>,
85+
/**
86+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/textContent)
87+
*/
88+
mutable textContent: Null.t<string>,
89+
// End base properties from Node
90+
91+
/**
92+
Returns the namespace.
93+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/namespaceURI)
94+
*/
95+
namespaceURI: Null.t<string>,
96+
/**
97+
Returns the namespace prefix.
98+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/prefix)
99+
*/
100+
prefix: Null.t<string>,
101+
/**
102+
Returns the local name.
103+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/localName)
104+
*/
105+
localName: string,
106+
/**
107+
Returns the HTML-uppercased qualified name.
108+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/tagName)
109+
*/
110+
tagName: string,
111+
/**
112+
Returns the value of element's id content attribute. Can be set to change it.
113+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/id)
114+
*/
115+
mutable id: string,
116+
/**
117+
Returns the value of element's class content attribute. Can be set to change it.
118+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/className)
119+
*/
120+
mutable className: string,
121+
/**
122+
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object.
123+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/classList)
124+
*/
125+
classList: domTokenList,
126+
/**
127+
Returns the value of element's slot content attribute. Can be set to change it.
128+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/slot)
129+
*/
130+
mutable slot: string,
131+
/**
132+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/attributes)
133+
*/
134+
attributes: namedNodeMap,
135+
/**
136+
Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise.
137+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/shadowRoot)
138+
*/
139+
shadowRoot: Null.t<shadowRoot>,
140+
/**
141+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/part)
142+
*/
143+
part: domTokenList,
144+
/**
145+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
146+
*/
147+
mutable scrollTop: float,
148+
/**
149+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
150+
*/
151+
mutable scrollLeft: float,
152+
/**
153+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
154+
*/
155+
scrollWidth: int,
156+
/**
157+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollHeight)
158+
*/
159+
scrollHeight: int,
160+
/**
161+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/clientTop)
162+
*/
163+
clientTop: int,
164+
/**
165+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/clientLeft)
166+
*/
167+
clientLeft: int,
168+
/**
169+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/clientWidth)
170+
*/
171+
clientWidth: int,
172+
/**
173+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/clientHeight)
174+
*/
175+
clientHeight: int,
176+
/**
177+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/currentCSSZoom)
178+
*/
179+
currentCSSZoom: float,
180+
/**
181+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/innerHTML)
182+
*/
183+
mutable innerHTML: string,
184+
/**
185+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/outerHTML)
186+
*/
187+
mutable outerHTML: string,
188+
/**
189+
Returns the child elements.
190+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/children)
191+
*/
192+
children: htmlCollection<element>,
193+
/**
194+
Returns the first child that is an element, and null otherwise.
195+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/firstElementChild)
196+
*/
197+
firstElementChild: Null.t<element>,
198+
/**
199+
Returns the last child that is an element, and null otherwise.
200+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/lastElementChild)
201+
*/
202+
lastElementChild: Null.t<element>,
203+
/**
204+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/childElementCount)
205+
*/
206+
childElementCount: int,
207+
/**
208+
Returns the first preceding sibling that is an element, and null otherwise.
209+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/previousElementSibling)
210+
*/
211+
previousElementSibling: Null.t<element>,
212+
/**
213+
Returns the first following sibling that is an element, and null otherwise.
214+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CharacterData/nextElementSibling)
215+
*/
216+
nextElementSibling: Null.t<element>,
217+
/**
218+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/assignedSlot)
219+
*/
220+
assignedSlot: Null.t<htmlSlotElement>,
221+
/**
222+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic)
223+
*/
224+
mutable ariaAtomic: Null.t<string>,
225+
/**
226+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete)
227+
*/
228+
mutable ariaAutoComplete: Null.t<string>,
229+
/**
230+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel)
231+
*/
232+
mutable ariaBrailleLabel: Null.t<string>,
233+
/**
234+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription)
235+
*/
236+
mutable ariaBrailleRoleDescription: Null.t<string>,
237+
/**
238+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy)
239+
*/
240+
mutable ariaBusy: Null.t<string>,
241+
/**
242+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked)
243+
*/
244+
mutable ariaChecked: Null.t<string>,
245+
/**
246+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount)
247+
*/
248+
mutable ariaColCount: Null.t<string>,
249+
/**
250+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex)
251+
*/
252+
mutable ariaColIndex: Null.t<string>,
253+
/**
254+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText)
255+
*/
256+
mutable ariaColIndexText: Null.t<string>,
257+
/**
258+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan)
259+
*/
260+
mutable ariaColSpan: Null.t<string>,
261+
/**
262+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent)
263+
*/
264+
mutable ariaCurrent: Null.t<string>,
265+
/**
266+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription)
267+
*/
268+
mutable ariaDescription: Null.t<string>,
269+
/**
270+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled)
271+
*/
272+
mutable ariaDisabled: Null.t<string>,
273+
/**
274+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded)
275+
*/
276+
mutable ariaExpanded: Null.t<string>,
277+
/**
278+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup)
279+
*/
280+
mutable ariaHasPopup: Null.t<string>,
281+
/**
282+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden)
283+
*/
284+
mutable ariaHidden: Null.t<string>,
285+
/**
286+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts)
287+
*/
288+
mutable ariaKeyShortcuts: Null.t<string>,
289+
/**
290+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel)
291+
*/
292+
mutable ariaLabel: Null.t<string>,
293+
/**
294+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel)
295+
*/
296+
mutable ariaLevel: Null.t<string>,
297+
/**
298+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaLive)
299+
*/
300+
mutable ariaLive: Null.t<string>,
301+
/**
302+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaModal)
303+
*/
304+
mutable ariaModal: Null.t<string>,
305+
/**
306+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine)
307+
*/
308+
mutable ariaMultiLine: Null.t<string>,
309+
/**
310+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable)
311+
*/
312+
mutable ariaMultiSelectable: Null.t<string>,
313+
/**
314+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation)
315+
*/
316+
mutable ariaOrientation: Null.t<string>,
317+
/**
318+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder)
319+
*/
320+
mutable ariaPlaceholder: Null.t<string>,
321+
/**
322+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet)
323+
*/
324+
mutable ariaPosInSet: Null.t<string>,
325+
/**
326+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed)
327+
*/
328+
mutable ariaPressed: Null.t<string>,
329+
/**
330+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly)
331+
*/
332+
mutable ariaReadOnly: Null.t<string>,
333+
/**
334+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired)
335+
*/
336+
mutable ariaRequired: Null.t<string>,
337+
/**
338+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription)
339+
*/
340+
mutable ariaRoleDescription: Null.t<string>,
341+
/**
342+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount)
343+
*/
344+
mutable ariaRowCount: Null.t<string>,
345+
/**
346+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex)
347+
*/
348+
mutable ariaRowIndex: Null.t<string>,
349+
/**
350+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText)
351+
*/
352+
mutable ariaRowIndexText: Null.t<string>,
353+
/**
354+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan)
355+
*/
356+
mutable ariaRowSpan: Null.t<string>,
357+
/**
358+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected)
359+
*/
360+
mutable ariaSelected: Null.t<string>,
361+
/**
362+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize)
363+
*/
364+
mutable ariaSetSize: Null.t<string>,
365+
/**
366+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaSort)
367+
*/
368+
mutable ariaSort: Null.t<string>,
369+
/**
370+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax)
371+
*/
372+
mutable ariaValueMax: Null.t<string>,
373+
/**
374+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin)
375+
*/
376+
mutable ariaValueMin: Null.t<string>,
377+
/**
378+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow)
379+
*/
380+
mutable ariaValueNow: Null.t<string>,
381+
/**
382+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText)
383+
*/
384+
mutable ariaValueText: Null.t<string>,
385+
}

src/DOM/DOM.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5542,7 +5542,7 @@ Any web page loaded in the browser and serves as an entry point into the web pag
55425542
TODO: mark as private once mutating fields of private records is allowed
55435543
*/
55445544
@editor.completeFrom(DOM.Document) and document = {
5545-
// Base properties from Node
5545+
// Base properties from Nodea
55465546
/**
55475547
Returns the type of node.
55485548
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeType)

0 commit comments

Comments
 (0)