| 465 | })) |
| 466 | |
| 467 | Sandbox.Output = class { |
| 468 | constructor(div) { this.div = div } |
| 469 | |
| 470 | clear() { |
| 471 | let clone = this.div.cloneNode(false) |
| 472 | this.div.parentNode.replaceChild(clone, this.div) |
| 473 | this.div = clone |
| 474 | } |
| 475 | |
| 476 | get empty() { |
| 477 | return !this.div.firstChild |
| 478 | } |
| 479 | |
| 480 | out(type, args) { |
| 481 | let wrap = document.createElement("pre") |
| 482 | wrap.className = "sandbox-output-" + type |
| 483 | for (let i = 0; i < args.length; ++i) { |
| 484 | let arg = args[i] |
| 485 | if (i) wrap.appendChild(document.createTextNode(" ")) |
| 486 | if (typeof arg == "string") |
| 487 | wrap.appendChild(document.createTextNode(arg)) |
| 488 | else |
| 489 | wrap.appendChild(represent(arg, 58)) |
| 490 | } |
| 491 | this.div.appendChild(wrap) |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | function span(type, text) { |
| 496 | let sp = document.createElement("span") |
nothing calls this directly
no outgoing calls
no test coverage detected