Todo list

known issues and future improvements.

[ all ] [ bugs ] [ enhancements ] [ features ] [ closed ]
  • Make JSXS be compatible with JavaScript 1.7 and E4X
    Introduce let and yield statements.
    enhancement; priority 1/5.
  • Concat variable declaration in same function (if final is more short)
    var a = 'a'; a += 'a'; var b = a; 
    to :
    var a = 'a',b; a += 'a'; b = a; 
    feature; priority 4/5.
  • Detect redundant value assigned by reference for add variable who factorize that
    var h = document.location.host,
    q = document.location.search,
    i = document.getElementById('myid');
    to :
    var a = document,
    b = a.location,
    h = b.host,
    q = b.search,
    i = a.getElementById('myid');
    feature; priority 4/5.
  • Remove bloc statement ({...}) but leave semicolon in if .. else and some others statements
    if (condition) { statement1; } else { statement2; }
    to :
    if (condition) statement1; else statement2; 
    feature; priority 3/5.
  • Parse "with" statement
    with (object) { object.attribute... ... }
    Actualy all the codes that it reports probably a syntax error.
    feature; priority 2/5.
  • Reduce varname in "catch" statement
    try { ... } catch (myvar) { myvar... }
    to :
    try { ... } catch (a) { a... }
    enhancement; priority 1/5.
  • Fix option "compatibility"
    This doesn't work if shrink option is desactivated.
    bug; priority 3/5.
  • Convert object property string defined
    var a = { 'test': 69, "69": 'test' };
    to :
    var a = { test: 69, 69: 'test' };
    feature; priority 3/5.
  • Reduce condition if true value
    var a = 'something'; if (a == true) { ... }
    to :
    var a='something';if(a){...}
    and
    if (true) { ... }
    to :
    if (1) {...}
    feature; priority 3/5.
  • Advanced reduce logical condition according to operator precedence and priority
    while ( (a = (b || true)) || (b != (a > 3) && b < 4)) { ... }
    to :
    while ( (a = b || true) || b != a > 3 && b < 4) { ... }
    feature; priority 2/5.
  • Detect redundant string value and assign to variable (if final is more short)
    if(a = "a value string" && b = "a value string"){}
    to :
    var c = "a value string";
    if(a = c && b = c){}
    feature; priority 3/5.
  • Remove semicolumn between do-while when compatibility option is actived
    This produce a syntax error, result is :
    do { ... }; while (...)
    bug; closed in v0.7.1
  • make a CLI
    php jsxs-cli.php -f script.js
    feature; priority 5/5.
Comments
posted by Tomap at 2009-07-13 12:50:05
At last, someone is getting further than YUI Compressor !!
Great!
You could add to your "todo list" :
fartorise string is necessary
like :
if(typeof a = "string" && typeof b = "string")
>> to :
var c = "string"
if(typeof a = c && typeof b = c)
posted by Xorax at 2009-07-17 02:42:31
Thx ! It's added ;)
posted by Loops at 2011-09-30 15:24:11
I discover some small issues on this tool, especially when I try to apply it on the jQuery library.


At first, the variable name generation fails on a 2-digits generation.

For example, it starts at "be" instead of "ba" and go out of usable character range (attempt to use variables like "b€" or "b{").

This can be quickly fix on the line 535 of Jsxs.php file:

( $c < 36 ? chr($c + 97) : chr($c + 65) )

by using this code:

( $c < 36 ? chr($c + 87) : chr($c + 29) )

You see that it is just a incorrect range usage, nothing else...


Also, the second bug is really more complicate.

The compatibility option break some code (especially the jQuery library) by adding a semi-colon where it should not.

I have found it on some declarations like "{code}(),", that turns to "{code};(),".

Hopefully, this option can be deactivated and everything works fine without.

NOTE: on jQuery 1.5.2, look for the string:

return d}(),e="then done fail isResolved

You will see than after transformation it becomes:

return d};(),e="then done fail isResolved

... oups

Thanks for this nice tool.

Loops
posted by Xorax at 2011-09-30 15:33:28
Thanks for your fix.
I'll test it and integrate it quickly.