MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / h

Function h

example/tests/gm_xhr_test.js:53–62  ·  view source on GitHub ↗
(tag, props = {}, ...children)

Source from the content-addressed store, hash-verified

51
52 // ---------- Small DOM helper ----------
53 function h(tag, props = {}, ...children) {
54 const el = document.createElement(tag);
55 Object.entries(props).forEach(([k, v]) => {
56 if (k === "style" && typeof v === "object") Object.assign(el.style, v);
57 else if (k.startsWith("on") && typeof v === "function") el.addEventListener(k.slice(2), v);
58 else el[k] = v;
59 });
60 for (const c of children) el.append(c && c.nodeType ? c : document.createTextNode(String(c)));
61 return el;
62 }
63
64 // value type helper
65 const typing = (x) => {

Callers 2

gm_xhr_test.jsFile · 0.70
logLineFunction · 0.70

Calls 5

forEachMethod · 0.80
entriesMethod · 0.80
addEventListenerMethod · 0.80
appendMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected