Opened 16 years ago
Closed 16 years ago
#3983 closed Bug (fixed)
Extra comma in toolbar definition causes JavaScript error in IE
Reported by: | Kirk schneider | Owned by: | Frederico Caldeira Knabben |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.0 |
Component: | UI : Toolbar | Version: | |
Keywords: | Confirmed IE Review+ | Cc: |
Description
When calling CKEDITOR.replace on this sample page http://72.197.202.64:33112/entries/show/5 with ie8 on a vista machine, I get the following Javascript Error
'length' is null or not an object ckeditor.js, line 67 character 1800
I do not get this error using Chrome or Firefox 3.5
Attachments (2)
Change History (13)
comment:1 Changed 16 years ago by
Milestone: | → CKEditor 3.0 |
---|
comment:2 Changed 16 years ago by
Keywords: | Pending added |
---|
comment:3 Changed 16 years ago by
Component: | General → UI : Toolbar |
---|---|
Keywords: | Confirmed added; Pending removed |
Owner: | set to Garry Yao |
Status: | new → assigned |
I'm able to catch to problem now simply with the configuration change.
comment:4 Changed 16 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
It's not a bug, the only problem is the config array CKEDITOR.editorConfig.config.toolbar is containing a extra comma end with weird result in IE. You should safely remove it.
Below from ECMAScript262: Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an Assignment Expression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined.
comment:5 Changed 16 years ago by
Note than in 2.x there was some extra checks in the toolbar initialization to avoid this problem as people loves to remove the "about" button and forget to correct the previous line.
comment:6 Changed 16 years ago by
thanks for getting on this so quickly. I spent some time trying to isolate this and provide a simpler example but I couldn't. I guess because in my simpler examples I was using the default config.
CKEditor is a great tool!!!
comment:7 Changed 16 years ago by
Keywords: | IE added |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
Summary: | Calling CKEDITOR.replace in ie8 causes javascript error → Extra comma in toolbar definition causes JavaScript error in IE |
This is actually a quite common mistake out there. People simply remove the toolbar rows from the definition (especially the About button), leaving that extra comma there.
In V2, to avoid confusion, we simply added a small check into the code for this specific case. We could do the same here also.
Changed 16 years ago by
Attachment: | 3983.patch added |
---|
comment:8 Changed 16 years ago by
Keywords: | Review? added |
---|---|
Owner: | changed from Garry Yao to Frederico Caldeira Knabben |
Status: | reopened → new |
It's not said that we need to do such kinds of checks everywhere though.
comment:9 Changed 16 years ago by
Status: | new → assigned |
---|
comment:10 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
The link is unreachable for me, could you please provide a reduced sample page file to help us locate the bug?