Opened 16 years ago
Closed 16 years ago
#2765 closed Bug (fixed)
CKEditor is leaving cke_expando indices in the HTML source in IE
Reported by: | Martin Kou | Owned by: | Garry Yao |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
Component: | Core : Output Data | Version: | SVN (FCKeditor) - Retired |
Keywords: | Confirmed IE Review? | Cc: |
Description
To reproduce:
- Open replacebyclass.html sample in IE6.
- Click anywhere in the paragraph within the editing area.
- Switch to source mode.
- You get something like this, note the _cke_expando attribute - it shouldn't be there:
<p _cke_expando="125"> This is some <strong _cke_expando="124">sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>
Attachments (7)
Change History (23)
comment:1 Changed 16 years ago by
Keywords: | Confirmed IE added |
---|
comment:2 Changed 16 years ago by
Priority: | Normal → High |
---|
comment:3 Changed 16 years ago by
Owner: | set to Garry Yao |
---|---|
Status: | new → assigned |
Changed 16 years ago by
Attachment: | element.js.diff added |
---|
comment:4 Changed 16 years ago by
Keywords: | Review? added |
---|
comment:5 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
Same reasons as #2764, except the tabs are correct in this patch.
- The URF-8 BOM character is making the patch non-usable.
- Please don't reformat the length of comments.
Changed 16 years ago by
Attachment: | 2765_3.patch added |
---|
Changed 16 years ago by
Attachment: | 2765_4.patch added |
---|
comment:7 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:8 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
comment:10 Changed 16 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Require to fix fakeobject html also.
Changed 16 years ago by
Attachment: | 2765_5.patch added |
---|
comment:11 Changed 16 years ago by
Keywords: | Review? added; Review+ removed |
---|
comment:12 follow-up: 13 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
Ok... yes in the last review I missed out line 116 in _source/core/htmlparser/element.js. Thanks for the correction.
_source/plugins/fakeobjects/plugin.js - there's actually a reason for putting the things like copyParser outside of init(). Function object construction is a relatively slow operation in JavaScript, so the frequency of function construction should be minimized - functional programming techniques, while powerful, should only be used when needed.
Now the reason for putting copyParser(), makeTagOpenerHtml(), etc. outside of init() is because if we place them outside, those function would be constructed only once, when the plugin.js file is loaded. If those functions are placed inside init(), then every init() call would trigger function construction, which slows down editor instantiation by a bit.
But why are we putting a function on the outside and execute it immediately? Without the outer function, anything defined in the plugin.js file (e.g. copyParser) would end up in the global namespace. Even though we can add them as private variables via _ attributes, many of the things declared in the plugin.js file are not used anywhere outside of the plugin itself. So it would make sense to create a local function scope to put those things in. Thus an outer function is defined to avoid polluting the global namespace, and avoid adding unnecessary properties under other global objects.
Not sure about the changes in htmldataprocessor plugin, Fred didn't leave any documentations about why the plugin is designed like that.
comment:13 Changed 16 years ago by
Replying to martinkou:
_source/plugins/fakeobjects/plugin.js - there's actually a reason for putting the things like copyParser outside of init(). Function object construction is a relatively slow operation in JavaScript, so the frequency of function construction should be minimized - functional programming techniques, while powerful, should only be used when needed.
yes,Martin,closures is more expensive than OO-style of object construction,sometimes it even introduce obscure scope errors, we need to reserve closures which refer to the editor instance in our plug-ins' init function. The latest revised patch didn't use closure.
comment:14 Changed 16 years ago by
My reason for modified _source/plugins/fakeobjects/plugin.js and _source/plugins/htmldataprocessor/plugin.js is that fakeobjects transformation has been performed after the normal html processing:
// Get the HTML version of the data. if ( editor.dataProcessor ) data = editor.dataProcessor.toHtml( data ); ... // Protect src or href attributes. data = protectUrls( data ); // Replace tags with fake elements. if ( editor.fakeobjects ) data = editor.fakeobjects.protectHtml( data );
So during the restore of fakeobject to real dom elements, some expando attrs were attached again, fakeobject is required to again use it's own editor's html-processor to clean it up, to make sure that even the fake objects's transformed output HTML were correctly formatted.
Are there other reasons for this patch's failure?
comment:15 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:16 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This one has been fixed with [3043].
Putting to high priority to get it fixed before the beta release.