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

Commit 8f95f67

Browse files
committed
Add getAttribute and setAttribute
1 parent 494a5c9 commit 8f95f67

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/DOM/Node/Element.js

+19
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,22 @@ exports.getElementsByClassName = function (classNames) {
6969
};
7070
};
7171
};
72+
73+
exports.setAttribute = function (name) {
74+
return function (value) {
75+
return function (element) {
76+
return function () {
77+
element.setAttribute(name, value);
78+
return {};
79+
};
80+
};
81+
};
82+
};
83+
84+
exports.getAttribute = function (name) {
85+
return function (element) {
86+
return function () {
87+
return element.getAttribute(name);
88+
};
89+
};
90+
};

src/DOM/Node/Element.purs

+3
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ foreign import setClassName :: forall eff. String -> Element -> Eff (dom :: DOM
2020
foreign import getElementsByTagName :: forall eff. String -> Element -> Eff (dom :: DOM | eff) HTMLCollection
2121
foreign import getElementsByTagNameNS :: forall eff. Nullable String -> String -> Element -> Eff (dom :: DOM | eff) HTMLCollection
2222
foreign import getElementsByClassName :: forall eff. String -> Element -> Eff (dom :: DOM | eff) HTMLCollection
23+
24+
foreign import setAttribute :: forall eff. String -> String -> Element -> Eff (dom :: DOM | eff) String
25+
foreign import getAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) (Nullable String)

0 commit comments

Comments
 (0)