Ticket #1239 (closed Bug: fixed)

Opened 3 years ago

Last modified 23 months ago

do {} while () is getting broken when compressed

Reported by: fredck 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

Changed 3 years ago by fredck

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

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

Changed 2 years ago by w.olchawa

  • keywords Confirmed added

Changed 2 years ago by w.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{};

Changed 23 months ago by fredck

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to FCKeditor 2.6.1

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.