Opened 7 years ago

Last modified 7 years ago

#17008 new Bug

Empty tag is removed when it's the only element in the content

Reported by: Jamie Owned by:
Priority: Normal Milestone:
Component: General Version: 4.6.2
Keywords: element removed Cc:

Description

Steps to reproduce

  1. Insert <div id="foo">&nbsp;</div> in the Source view
  2. Switch out of source view and back in
  3. <div> is removed

Expected result

Div should remain. If you add <p>&nbsp;</p> before or after the div remains.

Actual result

Div is removed.

Other details (browser, OS, CKEditor version, installed plugins)

Chrome 58.0.3029.81, Win 10, CKEditor 4.6.2

Config has:

config.protectedSource.push(/<i[^>]*><\/i>/g);

This prevents <i> from being removed, but:

config.protectedSource.push(/<div[^>]*><\/div>/g);

In the scenario above makes no difference to <div> being removed.

Added text to the div i.e. <div id="foo">Test</div> stops it from being removed.

Change History (1)

comment:1 Changed 7 years ago by Jamie

Adding a comment tag before or after the div also prevents it from being removed:

<!-- Begin Snippet -->
<div id="foo">&nbsp;</div>
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy