« Orinoco Silver+Gold and Cabletron Enterasys Roamabout cards support WPA after allResident Evil 4 Wii edition - Tips / Cheats / Hints »

Broken packed javascript libraries

Technical, Javascript, 167 words   English (AU)

These days alot of javascript libraries are released in packed format which is pretty much javascript compressed with Dean Edwards’ packer. It seems this trend combined with automated packing ends up with broken libraries. One of the errors I troubleshooted the other day affected the download manager at jquery ui using packed as the compression method. What you end up with when trying to use the packed library is the following error.

missing ; before statement

This is caused by people not following a core requirement of the packer.

Follow up:

The packer requires all statements to be terminated with semi-colons including function declarations.

This is best illustrated by the following code extracted from the example on Dean’s site

Code:

var input, output;
 
// notice the semi-colon at the END of function declarations
 
onload = function() {
  input = document.getElementById("input");
  output = document.getElementById("output");
  clearAll(true);
};
 
function packScript() {
  output.value = pack(input.value);
};
 
function clearAll(focus) {
  output.value = input.value = "";
  // the "if" statement is NOT terminated with a semi-colon
  if (focus) {
    input.focus();
  }
};

Trackback address for this post

This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)
March 2010
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Brinley Ang

Brinley Ang is a sysadmin, web dev, coder, geek boy, jedi knight fragger, caffine addict, deaf meloncholic and rockstar wannabe. Listens to the sex pistols and a wide assortment of heavy metal.

Make payments with PayPal - it's fast, free and secure!

Search
XML Feeds
home | blog | contact
© 2010 - Brinley Ang - All Rights Reserved