(node, type, val)
| 592 | } |
| 593 | |
| 594 | function expandObj(node, type, val) { |
| 595 | let wrap = document.createElement("span") |
| 596 | let opening = type == "array" ? "[" : "{", cname |
| 597 | if (opening == "{" && (cname = constructorName(val))) opening = cname + " {" |
| 598 | wrap.appendChild(document.createTextNode(opening)) |
| 599 | let block = wrap.appendChild(document.createElement("div")) |
| 600 | block.className = "sandbox-output-etc-block" |
| 601 | let table = block.appendChild(document.createElement("table")) |
| 602 | function addProp(name) { |
| 603 | let row = table.appendChild(document.createElement("tr")) |
| 604 | row.appendChild(document.createElement("td")).appendChild(span("prop", name + ":")) |
| 605 | row.appendChild(document.createElement("td")).appendChild(represent(val[name], 40)) |
| 606 | } |
| 607 | if (type == "array") { |
| 608 | for (let i = 0; i < val.length; ++i) addProp(i) |
| 609 | } else { |
| 610 | for (let prop in val) if (hop(val, prop)) addProp(prop) |
| 611 | } |
| 612 | wrap.appendChild(document.createTextNode(type == "array" ? "]" : "}")) |
| 613 | node.parentNode.replaceChild(wrap, node) |
| 614 | } |
| 615 | |
| 616 | function awaitEvent(target, event) { |
| 617 | return new Promise(accept => { |
no test coverage detected