Repository navigation
Commit 48bf644
authored
fix(webapi): correct binding nullability and exception contracts [Codex] (#349)
## Summary
- Corrects nullability and optionality across affected Web API bindings.
- Adds `@throws(JsExn)` where synchronous browser APIs can raise
exceptions.
- Models `HTMLElement.hidden` with the semantic states `Visible`,
`Hidden`, and `HiddenUntilFound`, without a raw coercion API.
- Updates compile-time fixtures for the corrected contracts.
## `HTMLElement.hidden`
The getter and setter use the same semantic type:
```rescript
element->HTMLElement.setHidden(HTMLElement.Hidden)
element->HTMLElement.setHidden(HTMLElement.HiddenUntilFound)
element->HTMLElement.setHidden(HTMLElement.Visible)
switch element->HTMLElement.hidden {
| HTMLElement.Visible => "visible"
| HTMLElement.Hidden => "hidden"
| HTMLElement.HiddenUntilFound => "hidden until found"
}
```
Because `setHidden` is an `@set` external, these calls emit direct
property assignments such as `element.hidden = true`.
An earlier version also exposed `hiddenInput` and `setHiddenRaw` to
mirror every Web IDL setter input. Those were removed because numbers,
arbitrary strings, `null`, and `undefined` only invoke coercion and do
not represent additional states. The binding intentionally restricts
writes to the three useful outcomes. See
[MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidden)
and the [HTML
Standard](https://html.spec.whatwg.org/multipage/interaction.html#dom-hidden).1 parent 0f8ec44 commit 48bf644
153 files changed
Lines changed: 711 additions & 549 deletions
File tree
- src
- animation
- canvas
- core
- crypto
- css-font-loading
- cssom
- device
- dom-nodes
- dom-platform
- event
- fetch
- file
- geometry
- html
- media
- messaging
- observers
- performance
- storage
- svg
- ui-events
- url
- web-audio
- window
- workers
- tests
- DOMAPI
- FetchAPI
- IntersectionObserverAPI
- ServiceWorkerAPI
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments