The classes defined for a fragment block (in documents) should be retained when the fragment block is rendered.
Actual Behaviour
The classes defined for the fragment block are not retained.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Include a fragment in a document and define specific classes for the fragment block.
Add CSS for the defined class.
Preview or publish the page. When the page is rendered, the CSS class is not applied because the class is missing from the HTML DOM.
HTML changes
The HTML structure of the fragment block differs from other blocks. Typically, the structure follows: container → wrapper → block. However, for the fragment block, it only includes container → wrapper, omitting the block level.
With this update, classes defined in the referred fragment section, which was previously copied into the fragment block section, will remain in the referred fragment section. Further, all the referred fragment sections will now be copied under the fragment block, ensuring the same HTML DOM standards as other blocks.
Expected Behaviour
Actual Behaviour
Reproduce Scenario (including but not limited to)
Steps to Reproduce
HTML changes
The HTML structure of the fragment block differs from other blocks. Typically, the structure follows: container → wrapper → block. However, for the fragment block, it only includes container → wrapper, omitting the block level.
With this update, classes defined in the referred fragment section, which was previously copied into the fragment block section, will remain in the referred fragment section. Further, all the referred fragment sections will now be copied under the fragment block, ensuring the same HTML DOM standards as other blocks.
Platform and Version
Verified with latest bolierplate code.
Sample Code that illustrates the problem
The problem is caused by this code section: https://github.com/adobe/aem-boilerplate/blob/main/blocks/fragment/fragment.js#L49-L52