If I'm not mistaken, this is correct because float and int representation in js_of_ocaml is "unboxed" (no Js.t around) and that it can be coerced to a js_string (can be fit in attr#value). Wouldn't it be better to provide some safe-by-construction "float_attr" and "int_attr" function in Dom and to call them here ?