Activate your free membership today | Log-in

Monday, April 2nd, 2007

Packer 3.0 and isMSIE hacks

Category: Tip, Utility

<>p>Dean Edwards has released Packer v3.0, one of the top utilities to squeeze your JavaScript like a lemon.

  • respects Microsoft conditional comments
  • new option to shrink variable and argument identifiers
  • removed the special chars feature
    (except the ;;; feature which people seem to like)
  • some bug fixes:
    • packer no longer closes spaces between the +/- operators so code like this is safe: c = a++ +b;
    • the throw"error"} bug that affected Safari (this is a Safari bug really but packer gets around it)
    • the __proto__ bug for Mozilla browsers (this only affected the online version of packer)
    • a minor parsing bug affecting the detection of regular expressions
  • simplified the user interface

Dean also had some fun sniffing browsers and came up with the short test:

JAVASCRIPT:
  1.  
  2. var isMSIE = /*@cc_on!@*/false;
  3.  

but then Sil came up with:

JAVASCRIPT:
  1.  
  2. var isMSIE//@cc_on=1
  3.  

Related Content:

  • PROPACKER
    ProPacker v1.0/v2.1/v3.0 Formats [ Asle / ReDoX...
  • Infected web pages reach almost 30,000 a day
    There has been a further rise in web-based threats, with internet security software firm Sophos uncovering an average of 29,700 new infected web pages...
  • ZFX
    CC3 File Packer...
  • HRT
    Hornet Packer Module /...
  • FC-M
    FC-M packer...

Posted by Dion Almaer at 9:14 am
6 Comments

+++--
3.6 rating from 18 votes

6 Comments »

Comments feed TrackBack URI

awesome, have always used dean’s packer for my projects.

Comment by Daniel Rust — April 2, 2007

Can someone explain why you’d ever want to compress you JS yourself instead of just using mod_deflate or your web server’s equivalent module? With hardware being so cheap, and compression not being very expensive, why not let the web server deal with it so you can deploy plain, formatted js (and css, and html, etc)?

Comment by Rob Sanheim — April 3, 2007

Rob, I feel you are entirely missing the point.
Compression plays a huge role in modern computing, the fact that the server has to perform the work every time the script is being loaded can be very redundant.

Also, this plays a role in saving bandwidth alongside processing, which can be key for all webmasters. One file being loaded and processed hundreds of times in a minute can be a noticeable difference.

Comment by Shawn K — April 4, 2007

Shawn: yes the web server will compress on every request, but I trust Apache or lighty have optimizations in there to handle common files (like your standard JS files).

If enabling mod_deflate really makes or breaks your server, you have much bigger issues then compressing your content.

Comment by Rob Sanheim — April 5, 2007

There are many situations where users don’t have access to mod_deflate or similar, so a packer like this is really useful.

Comment by Mr eel — April 26, 2007

@Rob:

dude….

there is so many reasons why this comment is flawed. And it doesnt take into account some projects where you have rediculourly high traffic and packing something can give good gains if you run js alot (ie Ajax or similar stuff)

Its not whether mod_deflate/iis gzip makes or breaks something – sometimes you want more than these things will offer and packer fills a void here

Comment by wiredone — December 16, 2008

Leave a comment

You must be logged in to post a comment.