Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit e125fa2

Browse files
committed
Merge pull request #20 from sharkdp/fix-setTextContent
Fix setTextContent type and FFI code
2 parents a0aba06 + 7b068fe commit e125fa2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/DOM/Node/Node.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ cases.
139139
#### `setTextContent`
140140

141141
``` purescript
142-
setTextContent :: forall eff. Node -> Eff (dom :: DOM | eff) Unit
142+
setTextContent :: forall eff. String -> Node -> Eff (dom :: DOM | eff) Unit
143143
```
144144

145145
If the node type is document fragment, element, text, processing

src/DOM/Node/Node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ exports.textContent = getEffProp("textContent");
5959
exports.setTextContent = function (value) {
6060
return function (node) {
6161
return function () {
62-
node.nodeValue = value;
62+
node.textContent = value;
6363
return {};
6464
};
6565
};

src/DOM/Node/Node.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ foreign import textContent :: forall eff. Node -> Eff (dom :: DOM | eff) String
7272
-- | If the node type is document fragment, element, text, processing
7373
-- | instruction, or comment this allows the node's data to be changed, or has
7474
-- | no effect in all other cases.
75-
foreign import setTextContent :: forall eff. Node -> Eff (dom :: DOM | eff) Unit
75+
foreign import setTextContent :: forall eff. String -> Node -> Eff (dom :: DOM | eff) Unit
7676

7777
-- | Removes empty text nodes and then combines any remaining text nodes that
7878
-- | are contiguous.

0 commit comments

Comments
 (0)