2
Some browsers do not support inputMode
, like Safari. So to then mitigate the situation, I would have another behavior if the inputMode
existed or not.
Searching I found the operator in
:
if ("inputMode" in document.querySelector("input")) {
console.log("Existe inputMode no <input>")
}
<input>
It works. The problem is, since I’m using another language, I have no way to call the operator in
(well I would have, but it would be a significantly bigger job just for that).
Is there any function that does the same as the in
?
How can I have the same behavior as in
without using this specific operator? Using any function (other than eval
, obviously).
I just don’t quite understand why you can’t use the
in
. Could you explain it a little better? I was curious.– Luiz Felipe
I’m using Golang, and compiling for Webassembly. Then the
querySelector
becomes:js.Global().Get("document").Call("querySelector", "input")
. I only have access to.Call
,.Invoke
and.InstanceOf
(...), but you don’t have any.In
. So I don’t assume there’s no way to use thein
. The functions I have access to are those. The "most difficult method" would be to create a Callimport to call my JS function inside the Golang, something like that from here. I withheld that information because it would make everything more confusing.– Inkeliz