Closed
Description
This might be an issue?
It is definitely a showstopper in many situation where one does not know whether the value (coming from somewhere else) might be an Integer or a Float. In one case the call to JS will succeed and in another it will fail.
Discussed in #211
Originally posted by sebnozzi May 12, 2023
When passing parameters in a JavaScript call Integers and Strings are converted just fine; but Floats aren't.
Why is this so?
Consider this code:
require "js"
JS.global[:window].call(:alert, 123) # works
JS.global[:window].call(:alert, 123.5) # FAILS
Instead, one has to resort to this:
JS.global[:window].call(:alert, JS.eval("return 123.5")) # works
Is this intended? Am I missing something? (seems like an overkill to me)
Also see my other thread about not being able to call to_js
to a Float value.
Metadata
Metadata
Assignees
Labels
No labels