You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2016/08/30 16:48:21 UTC

[jira] [Resolved] (SLING-5841) Self closing DIV when using 'html' context in Sightly

     [ https://issues.apache.org/jira/browse/SLING-5841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu resolved SLING-5841.
---------------------------------
    Resolution: Not A Problem

This is due to the AntiSamy {{useXHTML}} [directive|https://github.com/apache/sling/blob/org.apache.sling.xss-1.0.0/src/main/resources/SLING-INF/content/config.xml#L28], which is set to {{true}}. The reason for this is that when filtering self-closing tags we don't want to append a closing tag (the reverse of your example).

However, for your use-case you could do:
{code:html}
<custom-tag data-sly-element="${'div' @ context='html'}"></custom-tag>
{code}

This should work fine since SLING-5944 has been fixed.

> Self closing DIV when using 'html' context in Sightly
> -----------------------------------------------------
>
>                 Key: SLING-5841
>                 URL: https://issues.apache.org/jira/browse/SLING-5841
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Dan Chapman
>            Priority: Minor
>
> When I do:
> ${'<div></div>' @context='html'}
> It outputs invalid HTML, it self-closes the element:
> <div/>
> Only a set number of elements are permitted to self-close - http://xahlee.info/js/html5_non-closing_tag.html.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)