Closed kwin closed 2 years ago
The Sling Sightly Compiler seems to understand all formats of attribute values: https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler/blob/01a7b922d5c2f89974534cdeba0c8373d92a24c1/src/main/java/org/apache/sling/scripting/sightly/impl/html/dom/TagTokenizer.java#L203
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.
According to https://html.spec.whatwg.org/multipage/introduction.html#intro-early-example HTML attribute values must be either
The HTL spec at https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#21-syntax should explicitly state which form is supported!