ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

`<div>` is stripped out of the `<dd>` element

Open Mgsy opened this issue 1 year ago β€’ 1 comments

πŸ“ Provide detailed reproduction steps (if any)

  1. Go toΒ 
  2. Set the following content:
<dl>
	<dt><p>Question text</p></dt>
	<dd><p>Answer text starts here</p>
		<div>
			<p>Paragraph inside div</p>
			div content
		</div>
	</dd>
</dl>

βœ”οΈ Expected result

The markup is preserved.

❌ Actual result

<div> is stripped out and its paragraph is moved outside of the <dl> element:

<dl>
    <dt>
        <p>
            Question text
        </p>
    </dt>
    <dd>
        <p>
            Answer text starts here
        </p>
    </dd>
</dl>
<p>
    Paragraph inside div
</p>

πŸ“ƒ Other details

The dd element can contain the flow content, so it should preserve <div>.


If you'd like to see this fixed sooner, add a πŸ‘ reaction to this post.

Mgsy avatar Sep 18 '24 12:09 Mgsy

Hi @Witoso , Any update on this issue? We are also facing this problem. CKE5 is modifying HTML and stripping off <div> tag even enough we have enabled the General HTML support via below config to allow all tags. Note that this is a valid HTML also.

	allow: [
			{
				name: /.*/,
				attributes: true,
				classes: true,
				styles: true
			}
		],
  	disallow: [ ],
  	allowEmpty : [/.*/],
	}

sudheerb avatar Oct 15 '24 10:10 sudheerb

@sudheerb this is likely linked to the same issue in #15408 Apparently ckeditor converts the html to an abstract tree and then uses its own sanitizer on it which transforms html. The rules of this sanitizer aren't written down anywhere i can find, but a quick search in this repo reveals there are several bugs resulting from this sanitizer transforming valid html.

According to @Witoso in that same thread this wil not get fixed.

Badlapje avatar Jul 16 '25 13:07 Badlapje