Opened 8 years ago
Last modified 8 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
- Insert
<div id="foo"> </div>
in the Source view - Switch out of source view and back in
<div>
is removed
Expected result
Div should remain. If you add <p> </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.
Adding a comment tag before or after the div also prevents it from being removed: