Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit e9b48d5

Browse files
authored
Merge pull request #134 from coot/hasAttribute
Added DOM.Node.Element.hasAttribute
2 parents 9174791 + 502feb3 commit e9b48d5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/DOM/Node/Element.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ exports._getAttribute = function (name) {
8686
};
8787
};
8888

89+
exports.hasAttribute = function(name) {
90+
return function (element) {
91+
return element.hasAttribute(name);
92+
};
93+
};
94+
8995
exports.removeAttribute = function (name) {
9096
return function (element) {
9197
return function () {

src/DOM/Node/Element.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module DOM.Node.Element
1212
, getElementsByClassName
1313
, setAttribute
1414
, getAttribute
15+
, hasAttribute
1516
, removeAttribute
1617
, scrollTop
1718
, setScrollTop
@@ -63,6 +64,7 @@ getAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) (Maybe S
6364
getAttribute attr = map toMaybe <<< _getAttribute attr
6465

6566
foreign import _getAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) (Nullable String)
67+
foreign import hasAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) Boolean
6668
foreign import removeAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) Unit
6769

6870
foreign import scrollTop :: forall eff. Element -> Eff (dom :: DOM | eff) Number

0 commit comments

Comments
 (0)