Why can't I use `onWithOptions` in elm 0.19
Elm 0.19 does not use elm-lang/html
. You're reading the wrong documentation. It has been replaced by elm/html
which has a custom
function that serves the same purpose:
onClickNoBubble : msg -> Html.Attribute msg
onClickNoBubble message =
Html.Events.custom "click" (Decode.succeed { message = message, stopPropagation = True, preventDefault = True })
I made a little helper function to get this to work.
onCustomClick : msg -> Html.Attribute msg
onCustomClick msg =
custom "click"
(Decode.succeed
{ message = msg
, stopPropagation = True
, preventDefault = True
}
)