Ticket #4385 (closed Bug: fixed)
CheckDirty is not returning the correct state
| Reported by: | Senthil | Owned by: | garry.yao |
|---|---|---|---|
| Priority: | High | Milestone: | CKEditor 3.1 |
| Component: | General | Version: | |
| Keywords: | Oracle Confirmed Review+ | Cc: | Pranav, Senthil |
Description (last modified by fredck) (diff)
When i set empty data to the editor using the setdata method, checkdirty is returing the wrong state. Please follow the below steps to see the issue.
- Open the attached "replacebycode.html" file in IE and click the checkdirty button, this will return the message as 'false'.
- Now refresh the page and focus the editor area using the mouse cursor and select the checkdirty button, now you will get a message as "true" eventhough we don't change anything inside the editor area.
Attachments
Change History
comment:2 Changed 4 years ago by fredck
- Cc Pranav, Senthil added; Pranav Senthil removed
- Description modified (diff)
- Milestone changed from CKEditor 3.x to CKEditor 3.1
comment:3 Changed 4 years ago by garry.yao
- Keywords Confirmed Review? added
- Status changed from new to assigned
- Owner set to garry.yao
Ticket Test added at : http://ckeditor.t/tt/4385/1.html.
comment:4 Changed 4 years ago by garry.yao
This's one opposite effect of our auto fixing functionality, where the editor's fixing on DOM structure were confusing the dirty checking mechanism, considering it's changes from the user, which is wrong, I've set up a defensive guard for any future auto fixing rules.
comment:5 Changed 4 years ago by fredck
- Keywords Review- added; Review? removed
The idea about restoring the dirty status is good. I'm only seeing a drawback in the proposed implementation: performance.
The fact is that the checkDirty call is a bit expensive, specially for long documents. Another fact is that the onSelectionChangeFixBody call is made several times during the document life cycle, even when simply typing inside the editor. These facts together may represent some execution overload.
The onSelectionChangeFixBody function will not always perform document fixes. Actually this should happen rarely. So the implementation could be changed to restore the dirty status only if fixes are supposed to happen to the document. It means that checkDirty should be called only if necessary.
