Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Re: Compressing/Obfuscating a Javascript file

by Incognito (Pilgrim)
on Oct 10, 2001 at 05:49 UTC ( #117912=note: print w/replies, xml ) Need Help??

in reply to Re: Compressing/Obfuscating a Javascript file
in thread Compressing/Obfuscating a Javascript file

Actually, I think I figured this one out! Change the split regex to:
# do the magic and split into functions my @functions = split /(?=\bfunction\s\w+)/, $data;
What we're doing here is forcing the function to be followed by a name... But what if the function contains a named function? As in:
function InitializeTree (objBlah) { // Set up the event handling. with (objBlah) { test = function test2() { doSomethingHere(); }; } return (0); }
Then I believe that this may again fail... We have to come up with a regex that ignores functions within functions... That's way beyond me... any ideas?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://117912]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2020-04-05 01:17 GMT
Find Nodes?
    Voting Booth?
    The most amusing oxymoron is:

    Results (33 votes). Check out past polls.