-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* NamedNodeMap & Attr * Fix getting attributes * fix Attr * DOMTokenList * Updated to ps 0.15 * Fix es6 exports * Fix export again * Make eslint happy * Drop spago files for now * Extract names into separate modules, fix some attr stuff * Fix some stuff in `DOMTokenList` * Drop `getEffProp` introduction * Use conventional argument order * Use more types * Use more types still --------- Co-authored-by: flip111 <[email protected]>
- Loading branch information
Showing
23 changed files
with
416 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const _namespaceURI = (attr) => attr.namespaceURI; | ||
|
||
export const _prefix = (attr) => attr.prefix; | ||
|
||
export const localName = (attr) => attr.localName; | ||
|
||
export const getValue = (attr) => () => attr.value; | ||
|
||
export const setValue = (attr) => (value) => () => { | ||
attr.value = value; | ||
}; | ||
|
||
export const _ownerElement = (attr) => () => attr.ownerElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module Web.DOM.Attr | ||
( module Exports | ||
, namespaceURI | ||
, prefix | ||
, localName | ||
, getValue | ||
, setValue | ||
, ownerElement | ||
) where | ||
|
||
import Prelude | ||
|
||
import Data.Maybe (Maybe) | ||
import Data.Nullable (Nullable, toMaybe) | ||
import Effect (Effect) | ||
import Web.DOM.AttrName (AttrName) | ||
import Web.DOM.Internal.Types (Attr) as Exports | ||
import Web.DOM.Internal.Types (Attr, Element) | ||
import Web.DOM.NamespacePrefix (NamespacePrefix) | ||
import Web.DOM.NamespaceURI (NamespaceURI) | ||
|
||
foreign import _namespaceURI :: Attr -> Nullable NamespaceURI | ||
|
||
namespaceURI :: Attr -> Maybe NamespaceURI | ||
namespaceURI attr = toMaybe (_namespaceURI attr) | ||
|
||
foreign import _prefix :: Attr -> Nullable NamespacePrefix | ||
|
||
prefix :: Attr -> Maybe NamespacePrefix | ||
prefix attr = toMaybe (_prefix attr) | ||
|
||
foreign import localName :: Attr -> AttrName | ||
|
||
foreign import getValue :: Attr -> Effect String | ||
|
||
foreign import setValue :: Attr -> String -> Effect Unit | ||
|
||
foreign import _ownerElement :: Attr -> Effect (Nullable Element) | ||
|
||
-- | The element the attribute belongs to, unless the attribute is not (yet) | ||
-- | attached to an element. | ||
ownerElement :: Attr -> Effect (Maybe Element) | ||
ownerElement attr = map toMaybe (_ownerElement attr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Web.DOM.AttrName where | ||
|
||
import Prelude | ||
|
||
import Data.Newtype (class Newtype) | ||
|
||
-- | A wrapper for attribute names. | ||
newtype AttrName = AttrName String | ||
|
||
derive instance newtypeAttrName :: Newtype AttrName _ | ||
derive newtype instance eqAttrName :: Eq AttrName | ||
derive newtype instance ordAttrName :: Ord AttrName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Web.DOM.ClassName where | ||
|
||
import Prelude | ||
|
||
import Data.Newtype (class Newtype) | ||
|
||
-- | A wrapper for strings which are used as CSS classes. | ||
newtype ClassName = ClassName String | ||
|
||
derive instance newtypeClassName :: Newtype ClassName _ | ||
derive newtype instance eqClassName :: Eq ClassName | ||
derive newtype instance ordClassName :: Ord ClassName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Web.DOM.Document.CompatMode where | ||
|
||
import Data.Maybe (Maybe(..)) | ||
|
||
data CompatMode | ||
= BackCompat | ||
| CSS1Compat | ||
|
||
parse ∷ String -> Maybe CompatMode | ||
parse = case _ of | ||
"BackCompat" -> Just BackCompat | ||
"CSS1Compat" -> Just CSS1Compat | ||
_ -> Nothing | ||
|
||
print ∷ CompatMode -> String | ||
print = case _ of | ||
BackCompat → "BackCompat" | ||
CSS1Compat → "CSS1Compat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.