This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1
README HtmlHelpers

HtmlHelpers.Events

Some event helpers

stopClickPropagation : msg -> Attribute msg

Return an attribute that stops click propagation. A message must be supplied. Pass a NoOp message if you don't want the click to do anything.

onClickWithDefaultPrevented : msg -> Attribute msg

an onClick handler, where the default is prevented

module HtmlHelpers.Events exposing (..)

{-| Some event helpers

@docs stopClickPropagation
@docs onClickWithDefaultPrevented
-}

import Json.Decode
import Html exposing (Html, a, Attribute, span)
import Html.Events exposing (onWithOptions)

{-| Return an attribute that stops click propagation. A message must be supplied.
    Pass a NoOp message if you don't want the click to do anything.
-}
stopClickPropagation : msg -> Attribute msg
stopClickPropagation message =
  onWithOptions
    "click"
    { stopPropagation = True
    , preventDefault = False
    }
    (Json.Decode.succeed message)


{-| an onClick handler, where the default is prevented -}
onClickWithDefaultPrevented : msg -> Attribute msg
onClickWithDefaultPrevented message =
  onWithOptions
    "click"
    { preventDefault = True
    , stopPropagation = False
    }
    (Json.Decode.succeed message)