Subject: | bug found when minify jquery-1.3.2.js |
Date: | Sun, 17 May 2009 22:06:49 -0700 |
To: | <bug-JavaScript-Minifier [...] rt.cpan.org> |
From: | "Tao Wang" <tao.wang.pro [...] gmail.com> |
Hi, people,
Basically, I did something like
JavaScript::Minifier::XS::minify(jquery-1.3.2.js), (sure you can download
this jquery from
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.js)
The result code has js error, really took me a while, i found minify did the
wrong thing.
The original file
3384: accepts: {
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript,
application/javascript",
json: "application/json,
text/javascript",
text: "text/plain",
_default: "*/*"
}
....
// Set the Accepts header for the server, depending on the dataType
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
3534: s.accepts[ s.dataType ] + ", */*" :
s.accepts._default );
I guess minify() replace /*.*?*/s with blank. But see the code above
contain two "*/*", the result is totally wrong
accepts:{
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript,
application/javascript",
json: "application/json,
text/javascript",
text: "text/plain",
_default: "**" :
s.accepts._default );
I have no recommend at this moment. But I am 99% sure this is the cause.
JavaScript::Minifier 1.05
Perl 5.8.8
CentOS
Good luck.
Tao
Programmer
tao@eventful.com