1 |
export default function render(fn, useShadow) { |
|
2 |
return {
|
37✔ |
3 |
get: useShadow
|
|
4 |
? (host) => { |
|
5 |
const updateDOM = fn(host); |
55✔ |
6 |
const target = |
|
7 |
host.shadowRoot || |
|
8 |
host.attachShadow({ |
|
9 |
mode: "open", |
|
10 |
delegatesFocus: fn.delegatesFocus || false, |
|
11 |
}); |
|
12 |
return () => {
|
55✔ |
13 |
updateDOM(host, target); |
66✔ |
14 |
return target;
|
66✔ |
15 |
}; |
|
16 |
} |
|
17 |
: (host) => { |
|
18 |
const updateDOM = fn(host); |
144✔ |
19 |
return () => {
|
144✔ |
20 |
updateDOM(host, host); |
144✔ |
21 |
return host;
|
144✔ |
22 |
}; |
|
23 |
}, |
|
24 |
observe(host, flush) { |
|
25 |
flush(); |
199✔ |
26 |
}, |
|
27 |
}; |
|
28 |
} |