« Yet another cross domain AJAX solution | Resident Evil 4 Wii edition - Tips / Cheats / Hints » |
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();
}
};