_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

Error on adding attribute with specified value

Open ustitc opened this issue 3 years ago • 1 comments

Version: 0.9.4 and 0.9.5

Tried the code from an example:

<button _="on click add @disabled='true' to <button/> when it is not me">Disable Other Buttons</button>

but got an error:

[Error] hyperscript errors were found on the following element: (4)
<button _="on click add @disabled='true' to <button/> when it is not me">Disable Other Buttons</button>"

""Unexpected Token : =

on click add @disabled='true' to <button/> when it is not me
                      ^^

"c — core.js:1149parseHyperScript — core.js:1169R — core.js:1896(анонимная функция) — core.js:1876a — core.js:1430processNode — core.js:1872e — core.js:5638
	R (_hyperscript_web.min.js:1:16892)
	(анонимная функция) (_hyperscript_web.min.js:1:17879)
	a (_hyperscript_web.min.js:1:14554)
	processNode (_hyperscript_web.min.js:1:17813)
	e (_hyperscript_web.min.js:1:69299)

ustitc avatar Feb 22 '22 20:02 ustitc

I encountered the same issue. You can write add [@disabled=true] instead of add @disabled='true'.

You can test this on the Playground: https://hyperscript.org/playground/

<button _="on click add [@disabled=true]">Disable Me!</button>

shuuji3 avatar Dec 10 '22 11:12 shuuji3