Skip to content

Commit e8a03b0

Browse files
cprussingaryb
authored andcommitted
Add HTMLDocument.currentScript and HTMLElement.getAttribute. (#4)
Add `HTMLDocument.currentScript`
1 parent 1b34239 commit e8a03b0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Web/HTML/HTMLDocument.js

+6
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ exports._activeElement = function (doc) {
1717
return doc.activeElement;
1818
};
1919
};
20+
21+
exports._currentScript = function (doc) {
22+
return function () {
23+
return doc.currentScript;
24+
};
25+
};

src/Web/HTML/HTMLDocument.purs

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import Web.Event.EventTarget (EventTarget)
2929
import Web.HTML.HTMLDocument.ReadyState (ReadyState)
3030
import Web.HTML.HTMLDocument.ReadyState as ReadyState
3131
import Web.HTML.HTMLElement (HTMLElement)
32+
import Web.HTML.HTMLScriptElement (HTMLScriptElement)
3233
import Web.Internal.FFI (unsafeReadProtoTagged)
3334

3435
foreign import data HTMLDocument :: Type
@@ -77,3 +78,8 @@ foreign import _activeElement :: HTMLDocument -> Effect (Nullable HTMLElement)
7778

7879
activeElement :: HTMLDocument -> Effect (Maybe HTMLElement)
7980
activeElement = map toMaybe <<< _activeElement
81+
82+
foreign import _currentScript :: HTMLDocument -> Effect (Nullable HTMLScriptElement)
83+
84+
currentScript :: HTMLDocument -> Effect (Maybe HTMLScriptElement)
85+
currentScript = map toMaybe <<< _currentScript

0 commit comments

Comments
 (0)