MCPcopy Index your code
hub / github.com/WebReflection/wicked-elements / set

Function set

cjs/index.js:22–48  ·  view source on GitHub ↗
(value, m, l, o)

Source from the content-addressed store, hash-verified

20};
21
22const set = (value, m, l, o) => {
23 const handler = create(o, {element: {enumerable: true, value}});
24 for (let i = 0, {length} = l; i < length; i++)
25 value.addEventListener(l[i].t, handler, l[i].o);
26 m.set(value, handler);
27 if (handler.init)
28 handler.init();
29 const {observedAttributes} = o;
30 if (observedAttributes) {
31 const mo = new MutationObserver(attributeChangedCallback);
32 mo.observe(value, {
33 attributes: true,
34 attributeOldValue: true,
35 attributeFilter: observedAttributes.map(attributeName => {
36 if (value.hasAttribute(attributeName))
37 handler.attributeChanged(
38 attributeName,
39 null,
40 value.getAttribute(attributeName)
41 );
42 return attributeName;
43 })
44 });
45 attributes.set(mo, handler);
46 }
47 return handler;
48};
49
50const {drop, flush, parse} = QSAO({
51 query,

Callers 1

handleFunction · 0.70

Calls 2

initMethod · 0.80
attributeChangedMethod · 0.80

Tested by

no test coverage detected