Skip to content

Drop Effect wrapper on doctype #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Notable changes to this project are documented in this file. The format is based

Breaking changes:
- Migrate FFI to ES modules (#51 by @JordanMartinez)
- Unwrap returned `Effect` for `doctype` (#52 by @JordanMartinez)

New features:

Expand Down
4 changes: 3 additions & 1 deletion src/Web/DOM/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export const origin = getEffProp("origin");
export const compatMode = getEffProp("compatMode");
export const characterSet = getEffProp("characterSet");
export const contentType = getEffProp("contentType");
export const _doctype = getEffProp("doctype");
export function _doctype(doc) {
return doc["doctype"];
}
export const _documentElement = getEffProp("documentElement");

export function getElementsByTagName(localName) {
Expand Down
6 changes: 3 additions & 3 deletions src/Web/DOM/Document.purs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ foreign import compatMode :: Document -> Effect String
foreign import characterSet :: Document -> Effect String
foreign import contentType :: Document -> Effect String

doctype :: Document -> Effect (Maybe DocumentType)
doctype = map toMaybe <<< _doctype
doctype :: Document -> Maybe DocumentType
doctype = toMaybe <<< _doctype

foreign import _doctype :: Document -> Effect (Nullable DocumentType)
foreign import _doctype :: Document -> Nullable DocumentType

documentElement :: Document -> Effect (Maybe Element)
documentElement = map toMaybe <<< _documentElement
Expand Down