()
| 509 | |
| 510 | // triggered both ASAP on the living DOM and via MutationObserver later |
| 511 | const pyEditor = () => { |
| 512 | if (timeout) return; |
| 513 | timeout = setTimeout(resetTimeout, 250); |
| 514 | for (const [type, interpreter] of TYPES) { |
| 515 | const selector = `script[type="${type}-editor"]`; |
| 516 | for (const script of document.querySelectorAll(selector)) { |
| 517 | // avoid any further bootstrap by changing the type as active |
| 518 | script.type += "-active"; |
| 519 | // don't await in here or multiple calls might happen |
| 520 | // while the first script is being initialized |
| 521 | queue = queue.then(() => init(script, type, interpreter)); |
| 522 | } |
| 523 | } |
| 524 | return queue; |
| 525 | }; |
| 526 | |
| 527 | new MutationObserver(pyEditor).observe(document, { |
| 528 | childList: true, |
no test coverage detected