adobe/htl-spec

Clarify syntax of HTL block statements with respect to quoting of values

kwin opened this issue · 3 comments

kwin commented

According to https://html.spec.whatwg.org/multipage/introduction.html#intro-early-example HTML attribute values must be either

  1. Quoted in double quotes
  2. Quoted in single quotes
  3. Not quoted.

The HTL spec at https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#21-syntax should explicitly state which form is supported!

I'm not sure that not quoted values are fully supported in Sightly. I'm playing with it now and here are results:

<sly data-sly-text=${15}></sly> // OK, prints "15"
<sly data-sly-text=${true}></sly> // OK, prints "true"
<sly data-sly-text=${'text'}></sly> // ERROR 500

I'm getting error 500 for other blocks as well (data-sly-use, data-sly-test, etc). Error occurs when expression contains string literal or any expression being non-literal (eg. 15 > 2, true || false, true ? 'a' : 'b').
I know it is a part of Sightly implementation and not related to HTL specification, but maybe it will somehow help in spec as well. If not quoted values should be supported, then let me know to raise issue in Sightly implementation.

Clarification would be very useful.

@karollewandowski, I think you discovered a bug in the Sling implementation.

However, what @kwin mentions is valid. HTL is built on top of HTML, so the specification should be explicit when it comes to the attribute values.