itty-bitty icon indicating copy to clipboard operation
itty-bitty copied to clipboard

JS code with || operator becomes corrupted

Open Vort opened this issue 3 years ago • 2 comments

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)

Vort avatar Oct 14 '22 10:10 Vort

That's... incredibly odd. I'll look into it.

alcor avatar Oct 25 '22 00:10 alcor

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.

Vort avatar Apr 16 '23 12:04 Vort