Opened 6 years ago

Last modified 6 years ago

#13644 confirmed Bug

CKEditor shows no content anymore when character '<' is used in html comment

Reported by: Michel Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


Steps to reproduce

  1. Go to the ckeditor demo:
  2. Click button Broncode or Source code.
  3. Paste the following code before anything else in the texteditor.

<style type="text/css">

/* Test <9 */ </style>

Expected result

Original text is still shown

Actual result

Nothing is shown

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

Browser used: IE11.

If there is a space between < and 9 everything works. /* Test <9 */

Change History (5)

comment:1 Changed 6 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.5.3
Status: newconfirmed
Version: 4.5.2

Confirmed. Using "<" in a comment in CSS is valid, so it should not break the editor. We'll check if it's possible to fix our parser or whatever else fails

comment:2 Changed 6 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.5.3CKEditor 4.5.4

comment:3 Changed 6 years ago by Szymon Cofalik

Owner: set to Szymon Cofalik
Status: confirmedassigned

comment:4 Changed 6 years ago by Szymon Cofalik

Milestone: CKEditor 4.5.4
Owner: Szymon Cofalik deleted
Status: assignedconfirmed

This is caused by a bug in htmlparser engine. Unfortunately it is too complicated to be fixed in version 4.5.4.

Here is a description why the bug happens:

  1. In htmlparser we use a pretty sophisticated regular expression that finds tag openings.
  2. When the algorithm finds <style> tag, it looks further into code, looking for closing tag, but it finds <9 </style> instead.
  3. Algorithm never finds closing tag for <style>.

If <9 was a part of normal html code this won't be a bug but just invalid html code. Unfortunately, in <style> tag, in a comment, it is valid.

For further reference: to fix it, we would have to change how we look for closing tag when "cdata mode" is active (cdata variable is an array, not undefined). This sounds easy at the first glance but we have to keep in mind that current regexp is complicated right now and it is a part of a loop which reads html code part after part so making an exception might be difficult. Also we have to think about possible regressions.

Last edited 6 years ago by Szymon Cofalik (previous) (diff)

comment:5 Changed 6 years ago by Piotrek Koszuliński

DUP reported #13718.

Note: See TracTickets for help on using tickets.
© 2003 – 2021 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy