visotype / elm-dom / Dom.Internal

This module is exposed so that package developers can make use of Element record internals. It is not recommended for use in application code.

Internal Types


type Element msg
    = Element (Data msg)

The type exposed by Dom.elm. You can think of this as an abstraction of Element in the Document Object Model (DOM) interface to HTML and XML documents.


type alias Data msg =
{ tag : String
, id : String
, classes : List String
, styles : List ( String
, String )
, listeners : List ( String
, VirtualDom.Handler msg )
, attributes : List (VirtualDom.Attribute msg)
, text : String
, children : List (VirtualDom.Node msg)
, namespace : String
, keys : List String 
}

An Element's internal data. This is just a record containing all of the information needed to construct a VirtualDom node.

Internal Functions

modify : (Data msg -> Data msg) -> Element msg -> Element msg

Modify an Element's internal data by applying a record update function

render : Element msg -> VirtualDom.Node msg

Internal render function

Internal Helpers for Event Handling

capture : ( String, Json.Decode.Decoder a ) -> (a -> msg) -> VirtualDom.Handler msg

Construct a VirtualDom.Handler that captures input by proving the name of a field at event.target to capture, a decoder to read that field, and a message token to pass the result to the Elm program's update function

captureStopPropagation : ( String, Json.Decode.Decoder a ) -> (a -> msg) -> VirtualDom.Handler msg

Construct a VirtualDom.Handler with MayStopPropagation set to True

capturePreventDefault : ( String, Json.Decode.Decoder a ) -> (a -> msg) -> VirtualDom.Handler msg

Construct a VirtualDom.Handler with MayPreventDefault set to True

captureStopAndPrevent : ( String, Json.Decode.Decoder a ) -> (a -> msg) -> VirtualDom.Handler msg

Construct a VirtualDom.Handler with both Custom options set to True