Fix tests.

The 'insert into empty line' tests were not working properly because the
empty test lines were actually filled with a single-space default string
(to keep the width of empty lines in the terminal).
Use .childNodes instead of .-children.

.children has bad support on document and DocumentFragments.
Fix the broken line merging optimization.

- detect when the optimization does not apply, e.g. append-line without
  a following insert-overwrite
- detect insert-overwrites that are not on the last line
Honor the margin when appending new lines.

Only use append-line when the current margin spans the whole screen.
Reset the cursor position when switching to DECAPPMODE.

less seems to require this, though I couldn't find any documentation on the
exact APPMODE/SAVECUR/ALTBUF behavior.
Remove old comments and debugging aids.
Debug utility function.
Use the latest webkitwindow.

webkitwindow commit hash: f0f1d5f
Make erase_in_line (whole screen) work in DECALTBUF mode.

vim uses that to clear the screen before writing new contents when paging
through a file.