itty-bitty
itty-bitty copied to clipboard
JS code with || operator becomes corrupted
Try to make link with such code:
<script>document.write(0||1)</script>
It should just write 1, but instead browser shows
Uncaught SyntaxError: missing ) after argument list (at data:text/html;charset=utf-8,<base target="_top">%0A<script>document.write(0 1)</script>:2:24)
That's... incredibly odd. I'll look into it.
It happens because of this line: https://github.com/alcor/itty-bitty/blob/afe37fa0b34610c6f179a9b184a5d0e2a7c836fd/docs/edit.js#L297
@alcor is this typo and there should be just /[ \t]+/g or | really should be removed?
If it should, then what is the reason? Maybe I can try to guess how to fix it.