{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.HTMLSelectElement
(item, item_, itemUnsafe, itemUnchecked, namedItem, namedItem_,
namedItemUnsafe, namedItemUnchecked, addBefore, removeThis, remove,
checkValidity, checkValidity_, reportValidity, reportValidity_,
setCustomValidity, setAutofocus, getAutofocus, setDisabled,
getDisabled, getForm, getFormUnsafe, getFormUnchecked, setMultiple,
getMultiple, setName, getName, setRequired, getRequired, setSize,
getSize, getType, getOptions, setLength, getLength,
getSelectedOptions, setSelectedIndex, getSelectedIndex, setValue,
getValue, getWillValidate, getValidity, getValidationMessage,
getLabels, setAutocomplete, getAutocomplete, HTMLSelectElement(..),
gTypeHTMLSelectElement)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
item ::
(MonadDOM m) =>
HTMLSelectElement -> Word -> m (Maybe HTMLOptionElement)
item self index
= liftDOM ((self ^. jsf "item" [toJSVal index]) >>= fromJSVal)
item_ :: (MonadDOM m) => HTMLSelectElement -> Word -> m ()
item_ self index
= liftDOM (void (self ^. jsf "item" [toJSVal index]))
itemUnsafe ::
(MonadDOM m, HasCallStack) =>
HTMLSelectElement -> Word -> m HTMLOptionElement
itemUnsafe self index
= liftDOM
(((self ^. jsf "item" [toJSVal index]) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
itemUnchecked ::
(MonadDOM m) => HTMLSelectElement -> Word -> m HTMLOptionElement
itemUnchecked self index
= liftDOM
((self ^. jsf "item" [toJSVal index]) >>= fromJSValUnchecked)
namedItem ::
(MonadDOM m, ToJSString name) =>
HTMLSelectElement -> name -> m (Maybe HTMLOptionElement)
namedItem self name
= liftDOM ((self ^. jsf "namedItem" [toJSVal name]) >>= fromJSVal)
namedItem_ ::
(MonadDOM m, ToJSString name) => HTMLSelectElement -> name -> m ()
namedItem_ self name
= liftDOM (void (self ^. jsf "namedItem" [toJSVal name]))
namedItemUnsafe ::
(MonadDOM m, ToJSString name, HasCallStack) =>
HTMLSelectElement -> name -> m HTMLOptionElement
namedItemUnsafe self name
= liftDOM
(((self ^. jsf "namedItem" [toJSVal name]) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
namedItemUnchecked ::
(MonadDOM m, ToJSString name) =>
HTMLSelectElement -> name -> m HTMLOptionElement
namedItemUnchecked self name
= liftDOM
((self ^. jsf "namedItem" [toJSVal name]) >>= fromJSValUnchecked)
addBefore ::
(MonadDOM m, IsHTMLOptionElementOrGroup element,
IsHTMLElementOrLong before) =>
HTMLSelectElement -> element -> Maybe before -> m ()
addBefore self element before
= liftDOM
(void (self ^. jsf "add" [toJSVal element, toJSVal before]))
removeThis :: (MonadDOM m) => HTMLSelectElement -> m ()
removeThis self = liftDOM (void (self ^. jsf "remove" ()))
remove :: (MonadDOM m) => HTMLSelectElement -> Int -> m ()
remove self index
= liftDOM (void (self ^. jsf "remove" [toJSVal index]))
checkValidity :: (MonadDOM m) => HTMLSelectElement -> m Bool
checkValidity self
= liftDOM ((self ^. jsf "checkValidity" ()) >>= valToBool)
checkValidity_ :: (MonadDOM m) => HTMLSelectElement -> m ()
checkValidity_ self
= liftDOM (void (self ^. jsf "checkValidity" ()))
reportValidity :: (MonadDOM m) => HTMLSelectElement -> m Bool
reportValidity self
= liftDOM ((self ^. jsf "reportValidity" ()) >>= valToBool)
reportValidity_ :: (MonadDOM m) => HTMLSelectElement -> m ()
reportValidity_ self
= liftDOM (void (self ^. jsf "reportValidity" ()))
setCustomValidity ::
(MonadDOM m, ToJSString error) =>
HTMLSelectElement -> error -> m ()
setCustomValidity self error
= liftDOM (void (self ^. jsf "setCustomValidity" [toJSVal error]))
setAutofocus :: (MonadDOM m) => HTMLSelectElement -> Bool -> m ()
setAutofocus self val
= liftDOM (self ^. jss "autofocus" (toJSVal val))
getAutofocus :: (MonadDOM m) => HTMLSelectElement -> m Bool
getAutofocus self
= liftDOM ((self ^. js "autofocus") >>= valToBool)
setDisabled :: (MonadDOM m) => HTMLSelectElement -> Bool -> m ()
setDisabled self val
= liftDOM (self ^. jss "disabled" (toJSVal val))
getDisabled :: (MonadDOM m) => HTMLSelectElement -> m Bool
getDisabled self = liftDOM ((self ^. js "disabled") >>= valToBool)
getForm ::
(MonadDOM m) => HTMLSelectElement -> m (Maybe HTMLFormElement)
getForm self = liftDOM ((self ^. js "form") >>= fromJSVal)
getFormUnsafe ::
(MonadDOM m, HasCallStack) =>
HTMLSelectElement -> m HTMLFormElement
getFormUnsafe self
= liftDOM
(((self ^. js "form") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getFormUnchecked ::
(MonadDOM m) => HTMLSelectElement -> m HTMLFormElement
getFormUnchecked self
= liftDOM ((self ^. js "form") >>= fromJSValUnchecked)
setMultiple :: (MonadDOM m) => HTMLSelectElement -> Bool -> m ()
setMultiple self val
= liftDOM (self ^. jss "multiple" (toJSVal val))
getMultiple :: (MonadDOM m) => HTMLSelectElement -> m Bool
getMultiple self = liftDOM ((self ^. js "multiple") >>= valToBool)
setName ::
(MonadDOM m, ToJSString val) => HTMLSelectElement -> val -> m ()
setName self val = liftDOM (self ^. jss "name" (toJSVal val))
getName ::
(MonadDOM m, FromJSString result) => HTMLSelectElement -> m result
getName self = liftDOM ((self ^. js "name") >>= fromJSValUnchecked)
setRequired :: (MonadDOM m) => HTMLSelectElement -> Bool -> m ()
setRequired self val
= liftDOM (self ^. jss "required" (toJSVal val))
getRequired :: (MonadDOM m) => HTMLSelectElement -> m Bool
getRequired self = liftDOM ((self ^. js "required") >>= valToBool)
setSize :: (MonadDOM m) => HTMLSelectElement -> Word -> m ()
setSize self val = liftDOM (self ^. jss "size" (toJSVal val))
getSize :: (MonadDOM m) => HTMLSelectElement -> m Word
getSize self
= liftDOM (round <$> ((self ^. js "size") >>= valToNumber))
getType ::
(MonadDOM m, FromJSString result) => HTMLSelectElement -> m result
getType self = liftDOM ((self ^. js "type") >>= fromJSValUnchecked)
getOptions ::
(MonadDOM m) => HTMLSelectElement -> m HTMLOptionsCollection
getOptions self
= liftDOM ((self ^. js "options") >>= fromJSValUnchecked)
setLength :: (MonadDOM m) => HTMLSelectElement -> Word -> m ()
setLength self val = liftDOM (self ^. jss "length" (toJSVal val))
getLength :: (MonadDOM m) => HTMLSelectElement -> m Word
getLength self
= liftDOM (round <$> ((self ^. js "length") >>= valToNumber))
getSelectedOptions ::
(MonadDOM m) => HTMLSelectElement -> m HTMLCollection
getSelectedOptions self
= liftDOM ((self ^. js "selectedOptions") >>= fromJSValUnchecked)
setSelectedIndex ::
(MonadDOM m) => HTMLSelectElement -> Int -> m ()
setSelectedIndex self val
= liftDOM (self ^. jss "selectedIndex" (toJSVal val))
getSelectedIndex :: (MonadDOM m) => HTMLSelectElement -> m Int
getSelectedIndex self
= liftDOM
(round <$> ((self ^. js "selectedIndex") >>= valToNumber))
setValue ::
(MonadDOM m, ToJSString val) => HTMLSelectElement -> val -> m ()
setValue self val = liftDOM (self ^. jss "value" (toJSVal val))
getValue ::
(MonadDOM m, FromJSString result) => HTMLSelectElement -> m result
getValue self
= liftDOM ((self ^. js "value") >>= fromJSValUnchecked)
getWillValidate :: (MonadDOM m) => HTMLSelectElement -> m Bool
getWillValidate self
= liftDOM ((self ^. js "willValidate") >>= valToBool)
getValidity :: (MonadDOM m) => HTMLSelectElement -> m ValidityState
getValidity self
= liftDOM ((self ^. js "validity") >>= fromJSValUnchecked)
getValidationMessage ::
(MonadDOM m, FromJSString result) => HTMLSelectElement -> m result
getValidationMessage self
= liftDOM ((self ^. js "validationMessage") >>= fromJSValUnchecked)
getLabels :: (MonadDOM m) => HTMLSelectElement -> m NodeList
getLabels self
= liftDOM ((self ^. js "labels") >>= fromJSValUnchecked)
setAutocomplete ::
(MonadDOM m, ToJSString val) => HTMLSelectElement -> val -> m ()
setAutocomplete self val
= liftDOM (self ^. jss "autocomplete" (toJSVal val))
getAutocomplete ::
(MonadDOM m, FromJSString result) => HTMLSelectElement -> m result
getAutocomplete self
= liftDOM ((self ^. js "autocomplete") >>= fromJSValUnchecked)