js-ffi: move casting to native code

Putting language-specific casting code in Elm code makes it unportable
in the event that the compiler supports another target in the future. As
elm-d3 is D3 and therefore JavaScript-specific this is unlikely to be an
issue in the future, but it nevertheless a good practice.

Closes #1
runtime: fix sporadic error related to model update

The elm-d3 runtime sets up the model for a D3 custom element and then
later extends it in the render() callback. The update() callback uses
the added field, which is where the sporadic error occurs. The Elm
runtime occasionally decides to use the originally-setup model without
re-calling render(), leaving the model in a state that update() does not
expect.