Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DOMAPI/Element.res
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Returns element's first attribute whose qualified name is qualifiedName, and nul
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/getAttribute)
*/
@send
external getAttribute: (T.t, string) => string = "getAttribute"
external getAttribute: (T.t, string) => null<string> = "getAttribute"

/**
Returns the qualified names of all element's attributes. Can contain duplicates.
Expand Down
12 changes: 12 additions & 0 deletions tests/DOMAPI/Element__test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/DOMAPI/Element__test.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
external myElement: DOMAPI.element = "myElement"

switch myElement->Element.getAttribute("foo") {
| Null.Value(value) => value->Console.log
| Null => "nothing"->Console.log
}