diff options
author | HombreLaser <sebastian-440@live.com> | 2024-02-07 12:39:56 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2024-02-07 12:39:56 -0600 |
commit | a4dbf1cd8d0769b1ff1e0d99217f92b28b92e0d4 (patch) | |
tree | aa8296241013f252ae1a9504a3a3ba4347bea54e /static/js/comments | |
parent | a3a932f4810df43487ee63130a21ab4591813e0e (diff) |
Add javascript entrypoint
Diffstat (limited to 'static/js/comments')
-rw-r--r-- | static/js/comments/comment_form.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/static/js/comments/comment_form.js b/static/js/comments/comment_form.js index dff0803..6edde9f 100644 --- a/static/js/comments/comment_form.js +++ b/static/js/comments/comment_form.js @@ -2,8 +2,9 @@ class CommentForm { constructor(domain, post) { this.domain = domain; this.post = post; + this.parser = new DOMParser(); this.form_element = document.getElementById("comment-form"); - this.form_element.addEventListener("submit", this.submit); + this.form_element.addEventListener("submit", this.submit.bind(this)); } async submit(event) { @@ -19,7 +20,12 @@ class CommentForm { }, body: form }); - const body = response.body; + const response_page = this.htmlFromResponse(response.body); } catch(error) {} } -} + + htmlFromResponse(body) { + return this.parser.parseFromString(body, "text/html"); + } + } + |