« Yet another cross domain AJAX solutionResident Evil 4 Wii edition - Tips / Cheats / Hints »

Broken packed javascript libraries

Technical, Javascript, 167 words   Bookmark and Share

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.

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



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();
  }
};

November 2024
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  
 << <   > >>
Brinley Ang

Brinley Ang is a software engineer, sysadmin, 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
home | portfolio | blog | links | contact
© 2024 - Brinley Ang
Valid xhtml