Don't try to reposition cursor when input value isn't a string

Fixes #183
This commit is contained in:
Dan Holmsand 2015-09-07 09:45:02 +02:00
parent db54d327e9
commit 8766d722b8
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
(defproject reagent "0.5.1-rc2" (defproject reagent "0.5.1-SNAPSHOT"
:url "http://github.com/reagent-project/reagent" :url "http://github.com/reagent-project/reagent"
:license {:name "MIT"} :license {:name "MIT"}
:description "A simple ClojureScript interface to React" :description "A simple ClojureScript interface to React"

View File

@ -106,7 +106,9 @@
node-value (.' node :value)] node-value (.' node :value)]
(when (not= value node-value) (when (not= value node-value)
(if-not (and (identical? node (.-activeElement js/document)) (if-not (and (identical? node (.-activeElement js/document))
(has-selection-api? (.' node :type))) (has-selection-api? (.' node :type))
(string? value)
(string? node-value))
; just set the value, no need to worry about a cursor ; just set the value, no need to worry about a cursor
(.! node :value value) (.! node :value value)