aboutsummaryrefslogtreecommitdiff
path: root/assets_src/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'assets_src/js/lib')
-rw-r--r--assets_src/js/lib/ajax.js3
-rw-r--r--assets_src/js/lib/dom.js16
2 files changed, 19 insertions, 0 deletions
diff --git a/assets_src/js/lib/ajax.js b/assets_src/js/lib/ajax.js
index b189a92..71e3764 100644
--- a/assets_src/js/lib/ajax.js
+++ b/assets_src/js/lib/ajax.js
@@ -61,3 +61,6 @@ export async function post(url, body, options) {
61export async function del(url, body, options) { 61export async function del(url, body, options) {
62 return request('DELETE', url, body, options); 62 return request('DELETE', url, body, options);
63} 63}
64export async function put(url, body, options) {
65 return request('PUT', url, body, options);
66}
diff --git a/assets_src/js/lib/dom.js b/assets_src/js/lib/dom.js
index 3c2f4d9..82f5dd2 100644
--- a/assets_src/js/lib/dom.js
+++ b/assets_src/js/lib/dom.js
@@ -27,6 +27,22 @@ export function withClass(className) {
27 return arr; 27 return arr;
28} 28}
29 29
30export function firstChild(el, fn) {
31 if (!el) {
32 return null;
33 }
34
35 for (const child of el.childNodes) {
36 if (child.nodeName === '#text') {
37 continue;
38 }
39 if (fn(child)) {
40 return child;
41 }
42 }
43 return null;
44}
45
30export function next(el, fn) { 46export function next(el, fn) {
31 if (!el) { 47 if (!el) {
32 return null; 48 return null;