_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

parser error : `on click transition THE closest .card's opacity to 0 over 50ms then remove closest .card` should not mandate the capitalised article

Open lolrenx opened this issue 3 years ago • 2 comments

on click transition closest .card's opacity to 0 over 50ms then remove closest .card gives the following error : image

ref :

 
function parsePseudopossessiveTarget(parser, runtime, tokens) {
        var targets;
        if (
            tokens.matchToken("the") ||
            tokens.matchToken("element") ||
            tokens.matchToken("elements") ||
            tokens.currentToken().type === "CLASS_REF" ||
            tokens.currentToken().type === "ID_REF" ||
            (tokens.currentToken().op && tokens.currentToken().value === "<")
        ) {

lolrenx avatar May 19 '22 15:05 lolrenx

It's unfortunately required. Consider this:

set color to the first <input[type=color] />
transition color's background-color to 0 -- animates the input
transition color to 'red' -- animates `me`

We parse the code left-to-right, so it's difficult to distinguish how we should continue reading the code after we see color.

We could maybe add a new, simpler syntax:

animate closest .card to { opacity: 0; } over 500ms

The part between the curly braces being a CSS rule.

dz4k avatar Aug 03 '22 10:08 dz4k

thanks for weighing in!

lolrenx avatar Aug 03 '22 11:08 lolrenx