Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
42 stars 7 forks source link

The func command is not handling spacing in strings correctly when passed as evaluated variables #68

Closed bob2517 closed 3 years ago

bob2517 commented 3 years ago

This looks like it could just be a 2.4.0 thing - to repeat:

var: erroring "hi dude", okVar 25; func: testMe {erroring} {okVar}

Brings back pars incorrectly in the function: ["hi", "dude", 25]

Pars in this case should be: ["hi dude", 25]

The func command needs an alternative syntax upgrade anyway so that vars can be passed in as object references, but for now just sort this out so it works per this basic syntax.

bob2517 commented 3 years ago

Weird - this shouldn't be doing this - spaces are converted to something else before the split. Upgrading issue to weirdness.

bob2517 commented 3 years ago

This error makes sense now. The func command is correctly receiving this when it is hit - the variable is being converted correctly before reaching the command:

checkVar Hi "dude" 25

The correct func command should include double-quotes like this: func: testMe "{erroring}" {okVar};

The developer is responsibIe for adding the quotes. It means they can convert a number into a string by putting quotes around it, and booleans convert correctly. I should probably actually read my docs. Obviously a bigger note is needed somewhere - put this in:

"Variables are evaluated before reaching action commands. Because of this, ensure all string variables have double-quotes around them where needed when being passed into action commands. Otherwise you could end up with this result... (insert example here)."

Closing.

bob2517 commented 3 years ago

Actually - even with the double quotes added it was removing the inner quotes. They aren't escaped when evaluated as a variable. So I had to fix something after all...

bob2517 commented 3 years ago

Fixed on branch - closing.

bob2517 commented 3 years ago

Docs are updated. Just need to remove the code editor for the example on the website as the code editor doesn't allow JS and we need JS to add an external function into the iframe for the example to work, unless the html will accept a script tag. Trying that now.

bob2517 commented 3 years ago

It works! The code editor is awesome...