Module

DOM.Util.TextCursor.Element.Type

Package
purescript-textcursor
Repository
MonoidMusician/purescript-textcursor

#TextCursorElement Source

data TextCursorElement

A container for the two usable Element types:

  • HTMLInputElement
  • HTMLTextAreaElement

Note that not all HTMLInputElement nodes are valid, as they must contain text content. See validate for specifics.

Common operations are defined in TextCursor.Element.HTML.

Constructors

#htmlTextCursorElementToHTMLElement Source

htmlTextCursorElementToHTMLElement :: TextCursorElement -> HTMLElement

Convert a TextCursorElement to a generic HTMLElement. Useful for focus.

#read' Source

read' :: Foreign -> F TextCursorElement

Read a TextCursorElement from a Foreign type.

#readEventTarget Source

readEventTarget :: Event -> F TextCursorElement

Read a TextCursorElement from the target field of an Event.

#validate Source

validate :: forall eff. TextCursorElement -> Eff (dom :: DOM | eff) (Maybe TextCursorElement)

Validate a TextCursorElement. Input fields need to have one of the following types when this is called:

  • text (default)
  • email
  • search
  • url

#validate' Source

validate' :: forall eff. F TextCursorElement -> Eff (dom :: DOM | eff) (Maybe TextCursorElement)

Convert from a Foreign error computation (type F) to a validated TextCursorElement.

#lookupAndValidate Source

lookupAndValidate :: forall eff. ElementId -> Eff (dom :: DOM | eff) (Maybe TextCursorElement)

Look up a TextCursorElement in the document by id.

#lookupValidateAndDo Source

lookupValidateAndDo :: forall eff. ElementId -> (TextCursorElement -> Eff (dom :: DOM | eff) Unit) -> Eff (dom :: DOM | eff) Unit

Look up a TextCursorElement by id and run an action if found.