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

Commit c03d32b

Browse files
toastalgaryb
authored andcommitted
add document.activeElement (#136)
* add `document.activeElement` * Document -> HTMLDocument from the Node file * fix Eff type signature * remove `yarn.lock` and ignore it as well
1 parent 9621415 commit c03d32b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/node_modules/
77
/output/
88
*.tix
9+
yarn.lock

src/DOM/HTML/Document.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ exports._readyState = function (doc) {
1111
return doc.readyState;
1212
};
1313
};
14+
15+
exports._activeElement = function (doc) {
16+
return function () {
17+
return doc.activeElement;
18+
};
19+
};

src/DOM/HTML/Document.purs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ foreign import _readyState :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff)
2424

2525
readyState :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) ReadyState
2626
readyState = map (unsafePartial fromJust <<< parseReadyState) <<< _readyState
27+
28+
foreign import _activeElement :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) (Nullable HTMLElement)
29+
30+
activeElement :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) (Maybe HTMLElement)
31+
activeElement = map toMaybe <<< _activeElement

0 commit comments

Comments
 (0)