Skip to content

Commit 0c47ae3

Browse files
authored
Merge pull request #10 from bbarker/nodeValue_maybe
fixes #9 : nodeValue should return Effect (Maybe String)
2 parents b3c9d46 + 3f46a7a commit 0c47ae3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Web/DOM/Node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ exports._previousSibling = getEffProp("previousSibling");
4040

4141
exports._nextSibling = getEffProp("nextSibling");
4242

43-
exports.nodeValue = getEffProp("nodeValue");
43+
exports._nodeValue = getEffProp("nodeValue");
4444

4545
exports.setNodeValue = function (value) {
4646
return function (node) {

src/Web/DOM/Node.purs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ nextSibling = map toMaybe <<< _nextSibling
121121

122122
foreign import _nextSibling :: Node -> Effect (Nullable Node)
123123

124-
-- | If the node type is text, comment, or processing instruction this is the
125-
-- | node's data, or null in all other cases.
126-
foreign import nodeValue :: Node -> Effect String
124+
-- | If the node type is text, comment, or processing instruction this is
125+
-- | `Just` the node's data, or `Nothing` in all other cases.
126+
nodeValue :: Node -> Effect (Maybe String)
127+
nodeValue = map toMaybe <<< _nodeValue
128+
129+
foreign import _nodeValue :: Node -> Effect (Nullable String)
127130

128131
-- | If the node type is text, comment, or processing instruction this allows
129132
-- | the node's data to be changed, or has no effect in all other cases.

0 commit comments

Comments
 (0)