#4719 closed Bug (fixed)
IE does not escape attribute values properly
Reported by: | Dirk | Owned by: | Minh Nguyen |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.3 |
Component: | General | Version: | 3.0.1 |
Keywords: | Confirmed IE Review+ | Cc: |
Description
reproduce: (in WYSIWYG mode)
editorObj.setData('<a href="#" x="<a b="c"/>">a</a>')
In IE you will see:
" _cke_saved_href="#">a
source code:
<a href="http://localhost/t/backend/#" x="<a b=">" _cke_saved_href="#">a</a>
instead of:
a
source code:
<a href="#" x="<a b="c"/>">a</a>
Attachments (5)
Change History (19)
comment:1 Changed 15 years ago by
Keywords: | Confirmed IE added |
---|---|
Milestone: | → CKEditor 3.2 |
Priority: | High → Normal |
Changed 15 years ago by
Attachment: | 4719.patch added |
---|
comment:2 Changed 15 years ago by
Keywords: | Review? added |
---|---|
Owner: | set to Minh Nguyen |
Status: | new → assigned |
comment:3 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
The "quote" is already fixed in #4683 and we should be looking to fix other entities here.
Changed 15 years ago by
Attachment: | 4719_2.patch added |
---|
comment:4 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
Changed 15 years ago by
Attachment: | 4719_3.patch added |
---|
comment:5 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|---|
Milestone: | CKEditor 3.2 → CKEditor 3.3 |
The patch works well, and I was about to give it R+. In the last minute, I've decided also testing the performance of it by loading a log document and checking the output generation performance. It's almost 40% slower after the patch.
We need also some performance optimization at this point. If we want to you CKEDITOR.tools.htmlEncode, we need to rewrite it, much probably avoiding having a function call chain there. Otherwise we can think about optimizing it in the writter functions directly.
I had some doubt about the real need of encoding other chars inside attributes, but this is definitely a need according to the XML specs, which is inherited into XHTML, but not in HTML.
As the breaking issue here has been already fixed with [5007], we don't have much urgency here, so I'm moving this ticket to the 3.3.
comment:6 follow-up: 8 Changed 15 years ago by
Milestone: | CKEditor 3.3 → CKEditor 3.2 |
---|
Ops, moving back to the 3.2 as this patch is also fixing another important issue: pasting is not working on some cases. For example, it's not possible to past this entire page (all browsers): http://www.w3.org/TR/html4/
comment:7 follow-up: 9 Changed 15 years ago by
- 4719_3.patch breaks test case dt/core/tools::test_htmlEncode2, specifically character quote should not be always escaped, it's only feasible when considering an attribute value context, the php htmlspecialchars will be a good API ref for it.
- The current implementation of CKEDITOR.tools.htmlEncode is over complicated, it's safely enough to just escape manually five characters there, by a RegExp, without bothering DOM.
comment:8 follow-up: 10 Changed 15 years ago by
comment:9 Changed 15 years ago by
Replying to garry.yao:
- 4719_3.patch breaks test case dt/core/tools::test_htmlEncode2, specifically character quote should not be always escaped, it's only feasible when considering an attribute value context, the php htmlspecialchars will be a good API ref for it.
Well, not a big issue. It may avoid us having a dedicated htmlAttEncode function.
- The current implementation of CKEDITOR.tools.htmlEncode is over complicated, it's safely enough to just escape manually five characters there, by a RegExp, without bothering DOM.
The DOM trick is a nice attempt to make it work as fast as possible in all browsers. It's a nice solution, but we may change it so we avoid the functions chain.
comment:10 Changed 15 years ago by
Milestone: | CKEditor 3.2 → CKEditor 3.3 |
---|
Changed 15 years ago by
Attachment: | 4719_4.patch added |
---|
comment:11 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
Changed 15 years ago by
Attachment: | 4719_5.patch added |
---|
comment:12 Changed 15 years ago by
Keywords: | Review+ added; Review? removed |
---|
Please make the documentation of 'htmlEncodeAttr' better by emphasizing the escape happen in the context of a html attribute value.
This bug happen in IE when we have quote character in value of attribute.