Skip to content

Fix bugs, make compatible with new spago and prepare 7.0.0 release #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based

## [Unreleased]

Breaking changes:

New features:

Bugfixes:

Other improvements:

## [v7.0.0](https://github.com/purescript-web/purescript-web-dom/releases/tag/v7.0.0) - 2024-11-06

Breaking changes:
- The `id` function returns an `ElementId` instead of a `String`. (#58 by @nsaunders)
- The `setId` function is parameterized by `ElementId` instead of `String`. (#58 by @nsaunders)
Expand All @@ -13,12 +23,10 @@ Breaking changes:
- The `getAttribute`, `setAttribute`, `hasAttribute`, and `removeAttribute` functions are parameterized by `AttrName` instead of `String`. (#58 by @nsaunders)

New features:
- `AttrName`, `ClassName`, and `PropName` types have been added, migrated from [web-html](https://github.com/purescript-web/purescript-web-html). (#58 by @nsaunders)
- A new `ElementId` type, representing the value of an `id` property/attribute, has been added. (#58 by @nsaunders)

Bugfixes:

Other improvements:
- Added modules `NamedNodeMap`, `Attr` and `DOMTokenList` (#59 by @flip111)
- Added types `AttrName`, `AttrLocalName`, `ClassName`, and `PropName`, migrated from [web-html](https://github.com/purescript-web/purescript-web-html). (#58 by @nsaunders)
- Added type `ElementId`, representing the value of an `id` property/attribute. (#58 by @nsaunders)
- Added types `CompatMode`, `ElementName`, `NamespacePrefix` and `NamespaceURI` (#59 by @garyb)

## [v6.0.0](https://github.com/purescript-web/purescript-web-dom/releases/tag/v6.0.0) - 2022-04-27

Expand All @@ -27,12 +35,6 @@ Breaking changes:
- Unwrap returned `Effect` for `doctype` (#52 by @JordanMartinez)
- Port `getBoundingClientRect` from `web-html`; set arg to `Element` (#53 by @JordanMartinez)

New features:

Bugfixes:

Other improvements:

## [v5.0.0](https://github.com/purescript-web/purescript-web-dom/releases/tag/v5.0.0) - 2021-02-26

Breaking changes:
Expand All @@ -43,8 +45,6 @@ New features:
- Add support for ShadowRoot API (#34)
- Add support for `Element.matches` and `Element.closest` (#39)

Bugfixes:

Other improvements:
- Migrated CI to GitHub Actions and updated installation instructions to use Spago (#28, #30)
- Added a CHANGELOG.md file and updated pull request template (#35, #36, #37)
Expand Down
2 changes: 2 additions & 0 deletions src/Web/DOM/Attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export const _prefix = (attr) => attr.prefix;

export const localName = (attr) => attr.localName;

export const name = (attr) => attr.name;

export const getValue = (attr) => () => attr.value;

export const setValue = (attr) => (value) => () => {
Expand Down
8 changes: 6 additions & 2 deletions src/Web/DOM/Attr.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Web.DOM.Attr
, namespaceURI
, prefix
, localName
, name
, getValue
, setValue
, ownerElement
Expand All @@ -13,9 +14,10 @@ import Prelude
import Data.Maybe (Maybe)
import Data.Nullable (Nullable, toMaybe)
import Effect (Effect)
import Web.DOM.AttrLocalName (AttrLocalName)
import Web.DOM.AttrName (AttrName)
import Web.DOM.Internal.Types (Attr) as Exports
import Web.DOM.Internal.Types (Attr, Element)
import Web.DOM.Internal.Types (Attr) as Exports
import Web.DOM.NamespacePrefix (NamespacePrefix)
import Web.DOM.NamespaceURI (NamespaceURI)

Expand All @@ -29,7 +31,9 @@ foreign import _prefix :: Attr -> Nullable NamespacePrefix
prefix :: Attr -> Maybe NamespacePrefix
prefix attr = toMaybe (_prefix attr)

foreign import localName :: Attr -> AttrName
foreign import localName :: Attr -> AttrLocalName

foreign import name :: Attr -> AttrName

foreign import getValue :: Attr -> Effect String

Expand Down
12 changes: 12 additions & 0 deletions src/Web/DOM/AttrLocalName.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Web.DOM.AttrLocalName where

import Prelude

import Data.Newtype (class Newtype)

-- | A wrapper for attribute names.
newtype AttrLocalName = AttrLocalName String

derive instance newtypeAttrLocalName :: Newtype AttrLocalName _
derive newtype instance eqAttrLocalName :: Eq AttrLocalName
derive newtype instance ordAttrLocalName :: Ord AttrLocalName
12 changes: 6 additions & 6 deletions src/Web/DOM/DOMTokenList.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ export function setValue(list) {
};
}

export function tokens(list) {
export function tokens(domTokenList) {
return function () {
const result = [];
for (const token of list.tokens) {
result.push(token);
const tokens = [];
for (const token of domTokenList) {
tokens.push(token);
}
return result;
return tokens;
};
}
}
Loading