Difference between sly data-sly-test and div data-sly-test in Sightly/HTL

1. The sly will unwrap itself automatically when the expression in data-sly-test evaluates to true.

For Example: <sly data-sly-test="true">foo</sly> will render foo

2. The div will not unwrap automatically.

For Example: <div data-sly-test="true">foo</sly> will render <div>foo</div>

3. If you use data-sly-unwrap the div tag will unwrap. sly is just a shorthand.

For Example: <div data-sly-test="true" data-sly-unwrap>foo</sly> will render foo

Happy Coding !!

About Sagor Chowdhuri 17 Articles
AEM Developer

Be the first to comment

Leave a Reply

Your email address will not be published.


*