_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

Bug: Make `add` command safe for null values

Open benpate opened this issue 3 years ago • 0 comments

It seems like the add command does not accept null values, as in, I cannot say add [@attribute=true] to <something null>

Here's my example case: I have this hyperscript statement in a behavior

add [@type="button"] to <button/> in me

In HTML, if this behavior is called on a node that does not contain any buttons, this breaks, complaining that <button/> in me evaluates to null.

I think there are already other workarounds to use for this, for instance, the tell command should handle this better. But it would be nice for add to handle this gracefully, too.

benpate avatar Mar 01 '22 18:03 benpate