zhanjh / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Minify_Lines breaks on Prototype 1.6.1 #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.3
PHP version: 5.2.4

What steps will reproduce the problem?
1. Turn debug on
2. Minify prototype version 1.6.1 with debug flag

Expected output: Commented line numbers /* line# */

Actual output:

Some commented line numbers have /* line# *|, causing the script to fail to
run in debug mode.

Attached is the js source it created with the above procedure.

Original issue reported on code.google.com by watermar...@gmail.com on 1 Dec 2009 at 3:11

Attachments:

GoogleCodeExporter commented 9 years ago
I see. prototype161.js has several XPath expressions containing "/*":

var xpath = ".//*[local-name...
"//*[local-name()='li' o...
this.matcher = ['.//*'];...
descendant:   "//*",
child:        "/*",
return cond ? document._getElementsByXPath('.//*' + ...

I'll see if I can add more whitelisting of these expressions, but I probably 
won't 
get to this very soon. Here's the relevant method:
http://code.google.com/p/minify/source/browse/tags/release_2.1.3/min/lib/Minify/
Lines.php#78

A workaround is to just have the minify() method return the original string. At 
line 
42 insert:

if (preg_match('@prototype\\n*\.js@', $id)) {
    // skip troublesome file
    return $content;
}

Original comment by mrclay....@gmail.com on 1 Dec 2009 at 7:40

GoogleCodeExporter commented 9 years ago
In R411 and will be in next release.

Original comment by mrclay....@gmail.com on 9 May 2010 at 4:52