benmmurphy / jsdeminifier_xpi

MIT License
52 stars 16 forks source link

javascript parse bug #23

Open kazatsuyu opened 10 years ago

kazatsuyu commented 10 years ago

I tried using the JSD the page you were reading the Javascript like this.

var t = 26;
for(var i = 0; i <= t; ++i) {
  var a = '<div><div style="width:' + i++ / t * 100 + '%"></div></div>;
  console.log(a);
}

Result:

var t = 26;
for (var i = 0; i <= t; ++i) {
var a = '<div><div style="width:' + i++/ t * 100 + '%"></div > < /div>';
console.log(a);
}

Output:

<div><div style="width:0%"></div > < /div>
<div><div style="width:7.6923076923076925%"></div > < /div>
<div><div style="width:15.384615384615385%"></div > < /div>
<div><div style="width:23.076923076923077%"></div > < /div>
<div><div style="width:30.76923076923077%"></div > < /div>
<div><div style="width:38.46153846153847%"></div > < /div>
<div><div style="width:46.15384615384615%"></div > < /div>
<div><div style="width:53.84615384615385%"></div > < /div>
<div><div style="width:61.53846153846154%"></div > < /div>
<div><div style="width:69.23076923076923%"></div > < /div>
<div><div style="width:76.92307692307693%"></div > < /div>
<div><div style="width:84.61538461538461%"></div > < /div>
<div><div style="width:92.3076923076923%"></div > < /div>
<div><div style="width:100%"></div > < /div>

I think JSD thinks "/ t * 100 + '%"></div" is regular expression syntax.