Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Breaking changes:
- The `getAttribute`, `setAttribute`, `hasAttribute`, and `removeAttribute` functions are parameterized by `AttrName` instead of `String`. (#58 by @nsaunders)

New features:
- Added `isSameNode` function. (#44 by @wclr)
- `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)
- `scrollIntoView` and `scrollIntoViewWithOptions` (with typed `ScrollBehavior` and `ScrollLogicalPosition`) have been added. (#64 by @i-am-the-slime)
Expand Down
6 changes: 6 additions & 0 deletions src/Web/DOM/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export function isEqualNode(node1) {
};
}

export function isSameNode(node1) {
return function (node2) {
return node1.isSameNode(node2);
};
}

export function compareDocumentPositionBits(node1) {
return function (node2) {
return function () {
Expand Down
4 changes: 4 additions & 0 deletions src/Web/DOM/Node.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module Web.DOM.Node
, clone
, deepClone
, isEqualNode
, isSameNode
, compareDocumentPositionBits
, contains
, lookupPrefix
Expand Down Expand Up @@ -157,6 +158,9 @@ foreign import deepClone :: Node -> Effect Node
-- | Checks whether two nodes are equivalent.
foreign import isEqualNode :: Node -> Node -> Effect Boolean

-- | Checks whether two nodes are the same.
foreign import isSameNode :: Node -> Node -> Boolean

-- TODO: compareDocumentPosition that returns a semigroup or something instead of the bitmask value

-- | Compares the position of two nodes in the document.
Expand Down
Loading