Opened 16 years ago
Closed 16 years ago
#3504 closed Bug (fixed)
CKPackager creates invalid JavaScript
Reported by: | Josh Nisly | Owned by: | Wiktor Walc |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.0 |
Component: | Project : CKPackager | Version: | SVN (CKEditor) - OLD |
Keywords: | Confirmed 3.0RC Review+ | Cc: |
Description
When packing the en.js lang file, the packager mungers the file in such a way to cause the JavaScript Lint tool to complain. The specific problem is that in the "colors" object, it removes the quotes from the members. For example, "'008080' : 'Teal'," becomes "008080:'Teal',".
Attachments (2)
Change History (6)
comment:1 Changed 16 years ago by
Keywords: | Confirmed 3.0RC added |
---|---|
Milestone: | → CKEditor 3.0 |
Owner: | set to Wiktor Walc |
Changed 16 years ago by
Attachment: | 3504.patch added |
---|
comment:2 Changed 16 years ago by
Keywords: | Review? added |
---|
In the Ecma-262 specs (7.8.3 Numeric Literals), we have the following:
NumericLiteral :: DecimalLiteral HexIntegerLiteral
and later on:
DecimalLiteral :: DecimalIntegerLiteral... (...)
DecimalIntegerLiteral :: 0 NonZeroDigit DecimalDigitsopt
..so only 0 and numbers starting with 1-9 are ok. Because numbers starting with 0 are treated as octal numbers (Annex B, B.1.1), I think all we need to do is to modify regular expression in CKPackager and put numbers in single quotes if they start with '0'.
Changed 16 years ago by
Attachment: | 3504_2.patch added |
---|
comment:3 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
The fix looks good. I've added some tests for it with the new patch. Please use it for committing, if you think the changes are good.
comment:4 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've confirmed it in the nightly build. Some of the color entries are inside single quotes, while others don't have it. We should have some checks that automatically add the quotes if the name starts with a number.
Actually, I would take a look at the ECMA specs to properly check whether or not to have quotes there.