Module

Web.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

#toHTMLElement Source

toHTMLElement :: TextCursorElement -> HTMLElement

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

#read Source

read :: Element -> Maybe TextCursorElement

Read a TextCursorElement from an Element.

#readEventTarget Source

readEventTarget :: Event -> Maybe TextCursorElement

Read a TextCursorElement from the target field of an Event.

#validate Source

validate :: TextCursorElement -> Effect (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' :: Maybe TextCursorElement -> Effect (Maybe TextCursorElement)

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

#lookupAndValidate Source

lookupAndValidate :: String -> Effect (Maybe TextCursorElement)

Look up a TextCursorElement in the document by id.

#lookupValidateAndDo Source

lookupValidateAndDo :: String -> (TextCursorElement -> Effect Unit) -> Effect Unit

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