| 514 | } |
| 515 | |
| 516 | function representArray(val, space) { |
| 517 | space -= 2 |
| 518 | let wrap = document.createElement("span") |
| 519 | wrap.appendChild(document.createTextNode("[")) |
| 520 | for (let i = 0; i < val.length; ++i) { |
| 521 | if (i) { |
| 522 | wrap.appendChild(document.createTextNode(", ")) |
| 523 | space -= 2 |
| 524 | } |
| 525 | let next = space > 0 && represent(val[i], space) |
| 526 | let nextSize = next ? eltSize(next) : 0 |
| 527 | if (space - nextSize <= 0) { |
| 528 | wrap.appendChild(span("etc", "…")).addEventListener("click", () => expandObj(wrap, "array", val)) |
| 529 | break |
| 530 | } |
| 531 | space -= nextSize |
| 532 | wrap.appendChild(next) |
| 533 | } |
| 534 | wrap.appendChild(document.createTextNode("]")) |
| 535 | return wrap |
| 536 | } |
| 537 | |
| 538 | function representObj(val, space) { |
| 539 | let string = typeof val.toString == "function" && val.toString(), m |