Skip to content

Commit 9d78884

Browse files
authored
Set string props to empty on removal (#13)
* Set string props to empty on removal * Correct version constraint
1 parent d60c34f commit 9d78884

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"purescript-maybe": "^2.0.1",
3131
"purescript-unsafe-coerce": "^2.0.0",
3232
"purescript-bifunctors": "^2.0.0",
33-
"purescript-refs": "^2.0.0"
33+
"purescript-refs": "^2.0.0",
34+
"purescript-foreign": "^3.0.1"
3435
},
3536
"devDependencies": {
3637
"purescript-psci-support": "^2.0.0",

src/Halogen/VDom/DOM/Prop.purs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Control.Monad.Eff.Ref as Ref
1616
import Data.Maybe (Maybe(..), maybe)
1717
import Data.StrMap as StrMap
1818
import Data.Nullable (toNullable)
19+
import Data.Foreign (typeOf)
1920
import Data.Function.Uncurried as Fn
2021
import Data.Tuple (Tuple(..), fst, snd)
2122
import DOM (DOM)
@@ -190,4 +191,6 @@ unsafeGetProperty = Util.unsafeGetAny
190191

191192
removeProperty eff. Fn.Fn2 String DOM.Element (Eff (dom DOM | eff) Unit)
192193
removeProperty = Fn.mkFn2 \key el →
193-
Fn.runFn3 Util.unsafeSetAny key Util.jsUndefined el
194+
case typeOf (Fn.runFn2 Util.unsafeGetAny key el) of
195+
"string"Fn.runFn3 Util.unsafeSetAny key "" el
196+
_ → Fn.runFn3 Util.unsafeSetAny key Util.jsUndefined el

0 commit comments

Comments
 (0)