Opened 9 years ago
Last modified 9 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: |
Description
Steps to reproduce
- Go to the ckeditor demo: http://ckeditor.com/demo#full
- Click button Broncode or Source code.
- 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 9 years ago by
Milestone: | → CKEditor 4.5.3 |
---|---|
Status: | new → confirmed |
Version: | 4.5.2 |
comment:2 Changed 9 years ago by
Milestone: | CKEditor 4.5.3 → CKEditor 4.5.4 |
---|
comment:3 Changed 9 years ago by
Owner: | set to Szymon Cofalik |
---|---|
Status: | confirmed → assigned |
comment:4 Changed 9 years ago by
Milestone: | CKEditor 4.5.4 |
---|---|
Owner: | Szymon Cofalik deleted |
Status: | assigned → confirmed |
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.
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