_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

Bug in example code for javascript expressions

Open tmcw opened this issue 1 year ago • 0 comments

In this section: https://hyperscript.org/commands/js/#description

<button
  _="on click
           set text to #input.value
           js(me, text)
               if ('clipboard' in window.navigator) {
               	 return navigator.clipboard.writeText(text)
               	   .then(() => 'Copied');
               	   .catch(() => me.parentElement.remove(me))
               }
           end
           put message in my.innerHTML "
></button>

This example has a tiny bug - that semicolon on the line

.then(() => 'Copied');

This shouldn't be there - we're still chaining on the .catch on the line below.

tmcw avatar Jul 13 '23 19:07 tmcw