Skip to content

Commit 3cb774d

Browse files
authored
Merge pull request #221 from Freddy03h/dom-api-null
getElementById and getSelection could return null
2 parents cf878fa + d9d2607 commit 3cb774d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/DOMAPI/Document.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Returns the first element within node's descendants whose ID is elementId.
1515
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getElementById)
1616
*/
1717
@send
18-
external getElementById: (document, string) => element = "getElementById"
18+
external getElementById: (document, string) => null<element> = "getElementById"
1919

2020
/**
2121
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getAnimations)
@@ -443,7 +443,7 @@ Returns an object representing the current selection of the document that is loa
443443
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/getSelection)
444444
*/
445445
@send
446-
external getSelection: document => selection = "getSelection"
446+
external getSelection: document => null<selection> = "getSelection"
447447

448448
/**
449449
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/hasStorageAccess)

src/DOMAPI/DocumentFragment.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Returns the first element within node's descendants whose ID is elementId.
3838
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DocumentFragment/getElementById)
3939
*/
4040
@send
41-
external getElementById: (T.t, string) => element = "getElementById"
41+
external getElementById: (T.t, string) => null<element> = "getElementById"
4242

4343
/**
4444
Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.

src/DOMAPI/Window.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,4 +514,4 @@ external cancelIdleCallback: (window, int) => unit = "cancelIdleCallback"
514514
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/getSelection)
515515
*/
516516
@send
517-
external getSelection: window => selection = "getSelection"
517+
external getSelection: window => null<selection> = "getSelection"

src/Global.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,4 +744,4 @@ external cancelIdleCallback: int => unit = "cancelIdleCallback"
744744
/**
745745
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/getSelection)
746746
*/
747-
external getSelection: unit => selection = "getSelection"
747+
external getSelection: unit => null<selection> = "getSelection"

0 commit comments

Comments
 (0)