Opened 17 years ago

Closed 16 years ago

#1239 closed Bug (fixed)

do {} while () is getting broken when compressed

Reported by: Frederico Caldeira Knabben Owned by:
Priority: Normal Milestone: FCKeditor 2.6.1
Component: Project : CKPackager Version:
Keywords: Confirmed Cc:

Description

The following input:

do
{
    alert( 'Test' ) ;
}
while ( (keyElem = getNextSibling(keyElem)) != null );

Outputs like this:

do{alert('Test');};while ((keyElem=getNextSibling(keyElem))!=null);

To note the semi-colon added right before "while".

Change History (4)

comment:1 Changed 17 years ago by Frederico Caldeira Knabben

Moving the "while" right after the closing bracket workarounds the problem:

do
{
    alert( 'Test' ) ;
} while ( (keyElem = getNextSibling(keyElem)) != null );

comment:2 Changed 16 years ago by Wojciech Olchawa

Keywords: Confirmed added

comment:3 Changed 16 years ago by Wojciech Olchawa

#1239 has been marked as DUP

Actually not only while and do messes up the code. As mentioned in #1239 also finally adds a semi-colon. In my test for did the trick as well.

Input:

do
{
}
while
{
}
finally
{
}
for
{
}

Output:

do{};while{};finally{};for{};

comment:4 Changed 16 years ago by Frederico Caldeira Knabben

Milestone: FCKeditor 2.6.1
Resolution: fixed
Status: newclosed

This is quite a serious problem, as it is blocking the nightly.

Fixed with [1976], [1977] and [1978].

The for cause is not a problem. It impacts only statements that are linked with curly bracket blocks, like if...else, do...while and try...catch...finally.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy