Opened 12 years ago

Closed 12 years ago

#7607 closed Bug (wontfix)

Style attribute is deleted from the sourcecode while switching from Source to WYSIWYG

Reported by: tiago ferreira Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: CantFix Cc:


In version 2.X or 3.X of CKEditor, the "style" attribute is deleted from the sourcecode while switching from Source to WYSIWYG. On FCKeditor latest version (and nightly build), the problem is solved for Fire Fox and Chrome, but remains in IE (tested in the Demo at CK website).

A small test case would be, using IE6 or above (with WinXP or above):

  1. Move to Source view on the Editor;
  1. Add following html code:
<div class="test" style="#styleTest#"> test </div>
  1. Move to WYSIWYG view;
  1. Move back to Source view.

Note that if the style attribute includes regular css expressions it works just fine. I've tested it by replacing the code on step 2 for:

<div class="test" style="background-color: red">

Thanks in advanced,


Change History (4)

comment:1 Changed 12 years ago by Jakub Ś

Keywords: Clearing Style Attribute IE removed
Status: newconfirmed

I will confirm this ticket just in case but it looks like browser dependable.

In FF4, webkit, Opera - the code stays untouched.

In FF3.6 the contents of style attribute are removed but the attribute itself stays untouched.

In IE whole attribute is removed.

It has worked that way from CKEditor 3.0.

comment:2 Changed 12 years ago by tiago ferreira

Hi j.swiderski, thanks for your time, reviewing the ticket! Do you think this bug is going to be fixed to IE? Is that a lot of people uses the browser and it's kind of an interesting feature.

Best regards, Tiago

comment:3 Changed 12 years ago by Jakub Ś

I’ve based my judgment on a simple test. I have prepared a HTML page with a sample code (I did not use CKEditor):

<body contenteditable="true">
	<div class="test" style="#styleTest#"> test </div>

All browsers behaved just like described above.

If any one else from CKEditor core development team confirms that it's a browser dependable issue than it may (not necessarily) be treated as "won't fix". If it's not browser dependable than it most likely will be fixed.

comment:4 Changed 12 years ago by Frederico Caldeira Knabben

Keywords: CantFix added
Resolution: wontfix
Status: confirmedclosed

The problem here is that we feed the browser with the provided HTML. The browser itself cleanup invalid HMTML, so the style attribute is dropped.

There is nothing we can do here. My recommendation would be using a style syntax that is acceptable by the browser.

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