title: AEM - Sightly : data-sly-attribute erasing css on tag
body: <p>I am currently working on components for AEM 6.0, I've noticed a quite strange behavior of the data-sly-attribute sightly attribute and I'm wondering if this is something that has been noticed by others (maybe a bug). </p>
  
  <p>Take the following code:</p>
  
  <p><strong>TEMPLATE</strong> (<em>html</em>)</p>
  
  <pre><code>&lt;div id="${properties.divId}" 
  data-sly-use.attr="com.something.sightly.promoModel" 
       data-sly-attribute="${attr.attributeMap}"&gt;
  
       &lt;a href="www.example.com" 
          class="btn btn-transparent" 
          data-sly-attribute.target="${properties.ckbNewWindow}" 
          **data-sly-attribute="${attr.attributeMap}"**&gt;
         ${properties.ctaText}
      &lt;/a&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Model</strong> (<em>java</em>)</p>
  
  <pre><code>public class PromoModel{
      protected HashMap&lt;String, String&gt; attributeMap = new HashMap&lt;String, String&gt;();
      @Override
      public void activate() throws Exception {
          attributeMap= ComponentUtils.buildDataAttributeMapFromResource(Constants.DATA_ATTRIBUTES_FIELD, getRequest());
  }
  
  public HashMap&lt;String, String&gt; getAttributeMap(){
      return attributeMap;
  
  }
  </code></pre>
  
  <p>with buildDataAttributeMapFromResource function that basically populates the HashMap based on what content is in the component.</p>
  
  <p>The issue is, when this code is executed on Author it works great but when I execute it on a Publisher the:</p>
  
  <pre><code>class="btn btn-transparent"
  </code></pre>
  
  <p>does not render.
  It seems like data-sly-attribute is overwriting it and thus erasing it because if I change my template to this:</p>
  
  <pre><code>&lt;div id="${properties.divId}" 
  data-sly-use.attr="com.something.sightly.promoModel" 
       data-sly-attribute="${attr.attributeMap}"&gt;
  
       &lt;a **data-sly-attribute="${attr.attributeMap}"**
          href="www.example.com" 
          class="btn btn-transparent" 
          data-sly-attribute.target="${properties.ckbNewWindow}"&gt;
         ${properties.ctaText}
      &lt;/a&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Notice that </p>
  
  <pre><code>data-sly-attribute="${attr.attributeMap}"
  </code></pre>
  
  <p>is in front of </p>
  
  <pre><code>class="btn btn-transparent"
  </code></pre>
  
  <p>it renders perfectly fine on Author and Publisher.</p>
  
  <p>Bug ?
  Maybe there is a fix for this out there that I'm not aware of ... ?
  Any advice would be great.</p>
  
  <p>Thanks
  Nicola</p>