Opened 13 years ago

Last modified 13 years ago

#6415 confirmed Bug

Style defined in stylecombo plugin with "pre" element ignores class property in Internet Explorer when applied without selecting text

Reported by: Nicolás Cardelino Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.4.1
Keywords: IE Cc:

Description

Steps to reproduce:

  1. Define the following style:
CKEDITOR.config.stylesCombo_stylesSet = 'wiki_styles';

CKEDITOR.addStylesSet('wiki_styles',
[
    { name: 'Code', element: 'pre', attributes: { 'class': 'Code'} }
]);
  1. From Internet Explorer, write a paragraph and place the cursor at the begining of the paragraph.
  2. Select the style defined in step 1 from the styles combo (named "Code").


After following these steps, the text entered in step 2 will be inside a pre element, but the class attribute won't be defined.

CKEditor version: 3.4.1
Browser: Internet Explorer 8
OS: Ms Windows 7

I debugged the code and found that the problem is in the "toPre" function located in "_source\plugins\styles\plugin.js". According to the comment, IE normalizes innerHtml to <pre>, breaking whitespaces, and to avoid that, a new <pre> element is created. The new <pre> lacks the original class attribute (and all other attributes) defined in the style definition.

Thanks!

Change History (2)

comment:1 Changed 13 years ago by Krzysztof Studnik

Status: newconfirmed

Confirmed also on CKEditor 3.4.2 trunk

  • Result of test case:
    <pre>
    <span style="display: none;"> </span>test</pre>
    
  • After repeated step 2 and 3 once more.
    <pre class="Code">
    <span style="display: none;"> </span>test</pre>
    

comment:2 Changed 13 years ago by Krzysztof Studnik

Component: GeneralCore : Styles
Keywords: IE added
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