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

Commit

Permalink
Merge pull request #13 from manpages/attributes
Browse files Browse the repository at this point in the history
Add setAttribute and getAttribute
  • Loading branch information
garyb committed Aug 22, 2015
2 parents 494a5c9 + 8f95f67 commit 8311b81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/DOM/Node/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,22 @@ exports.getElementsByClassName = function (classNames) {
};
};
};

exports.setAttribute = function (name) {
return function (value) {
return function (element) {
return function () {
element.setAttribute(name, value);
return {};
};
};
};
};

exports.getAttribute = function (name) {
return function (element) {
return function () {
return element.getAttribute(name);
};
};
};
3 changes: 3 additions & 0 deletions src/DOM/Node/Element.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ foreign import setClassName :: forall eff. String -> Element -> Eff (dom :: DOM
foreign import getElementsByTagName :: forall eff. String -> Element -> Eff (dom :: DOM | eff) HTMLCollection
foreign import getElementsByTagNameNS :: forall eff. Nullable String -> String -> Element -> Eff (dom :: DOM | eff) HTMLCollection
foreign import getElementsByClassName :: forall eff. String -> Element -> Eff (dom :: DOM | eff) HTMLCollection

foreign import setAttribute :: forall eff. String -> String -> Element -> Eff (dom :: DOM | eff) String
foreign import getAttribute :: forall eff. String -> Element -> Eff (dom :: DOM | eff) (Nullable String)

0 comments on commit 8311b81

Please sign in to comment.