Ticket #2246 (new New Feature)
Create local short named aliases to global references
| Reported by: | fredck | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.x |
| Component: | Project : CKPackager | Version: | |
| Keywords: | Confirmed | Cc: |
Description
The packager should be able to scan a function for all global references made inside of it. A global reference is a name not declared inside the function scope with the "var" or "function" statements.
For example, suppose we have the following function:
function( param )
{
if ( CKEDITOR.env.IE || CKEDITOR.tools.trim( param ) == '' )
CKEDITOR.doStuff();
CKEDITOR.doOtherStuff();
if ( CKEDITOR.env.IE )
alert( CKEDITOR );
return CKEDITOR.tools.trim( CKEDITOR.doAgain() );
}
... it would end up like this:
function( A )
{
var B = CKEDITOR;
var C = B.env.IE,
D = B.tools.trim;
if ( C || D( A ) == '' )
B.doStuff();
B.doOtherStuff();
if ( C )
alert( B );
return D( B.doAgain() );
}
Note that the code is smart enough to reuse the new names when creating other var names too.
Change History
Note: See
TracTickets for help on using
tickets.