aboutsummaryrefslogtreecommitdiff
path: root/tmp/todo
blob: b6f58dbad6dc1ed59be8dd8507b2e5e624399c3e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
✓ a = a + x ==> a+=x

*******

✓ join consecutive var statements

*******
✓
x == false ==> x == 0
x == true  ==> x == 1

should warn too;
JS is so sloppy that this could be an indication of a bug.

*******

✓

x, x ==> x
x = foo, x ==> x

other similar cases?

*******

Try to concatenate all scripts somehow before starting minification;
the issue will be keeping track of the current source file for
generating source maps.  perhaps store that in the AST?  Have a single
AST_Toplevel for all files.

XXX?  Not sure if this is worth the trouble.

*******

✓

discard spurious break statements

*******

for (...) {
  if (foo) continue;
  ...
}

==>

for (...) {
  if (!foo) { ... }
}

*******

The following seems to compress suboptimally.  Should probably run more
passes somewhere.

function setOpacity(el, o) {
    if (o != null) {
        if (o == "" && o != 0) {
            is_ie
                ? el.style.filter = ""
                : el.style.opacity = "";
        } else {
            is_ie
                ? el.style.filter = "alpha(opacity=" + Math.round(o * 100) + ")"
                : el.style.opacity = o;
        }
        return o;
    } else {
        if (!is_ie)
            return parseFloat(el.style.opacity);
        else
            if (/alpha\(opacity=([0-9.])+\)/.test(el.style.opacity))
                return parseFloat(RegExp.$1);
    }
}

*******