MCPcopy Create free account
hub / github.com/WebReflection/wicked-elements / set

Function set

esm/index.js:21–47  ·  view source on GitHub ↗
(value, m, l, o)

Source from the content-addressed store, hash-verified

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

Callers 1

handleFunction · 0.70

Calls 2

initMethod · 0.80
attributeChangedMethod · 0.80

Tested by

no test coverage detected