Closed maiargu closed 7 months ago
Your HTML content consists of more than one root element. This is not supported by the HTML control. Wrap the content in e.g. a <div>
and rendering behaves as you expect it.
The documentation for the content
property states:
The HTML control currently doesn't prevent the usage of multiple root nodes in its DOM content (e.g. setContent("
")), but this is not a guaranteed feature. The accepted content might be restricted to single root nodes in future versions. To notify applications about this fact, a warning is written in the log when multiple root nodes are used.
Thanks, proposed solution to wrap everything in a parent <div>
tag works.
URL (minimal example if possible): https://jsfiddle.net/maiagru/fr4L6exu/3/
Steps to reproduce the problem:
set content for a core:HTML component with property preferDOM="false"
html is rendered fine![image](https://github.com/SAP/openui5/assets/92865676/d300b333-225c-4c97-8eef-788644474c89)
set content for the second time by pressing the button "Add HTML" in the provided example jsfiddle
the html gets mixed up because previous lines from the previous rendering are still maintained instead of being destroyed![image](https://github.com/SAP/openui5/assets/92865676/1175d1c1-3993-4c55-acd0-95a40cbf721e)
What is the expected result? Expected result is to see as html content for the second rendering only the lines
a
b
c
What happens instead? In the second rendering
b
c from the previous rendering are appended to the current rendering.
Any other information? (attach screenshot if possible) Maybe related https://github.com/SAP/openui5/issues/3683