jQuery/Packer/ActiveX Bug

Non-packed: The SWF doesn't have to be activated. See: source.js

Packed: The user has to click to active the ActiveX control. See: packed.js

After Microsoft lost the Eolas patent lawsuit, they added a “feature” that requires users to click on each ActiveX control (Flash, Quicktime, etc.) before they can interact with it. As a workaround, plugins inserted into the page by an external javascript don't have to be activated.

The Problem

While working on my jQuery Flash plugin, I came across a bug — when using the packed version of jQuery, flash movies had to be activated (Bug Report #930).

Fixes

  1. Patch jQuery (recommended).
    Patching jQuery is a little bit of extra work, but won't add (hardly) any filesize. Here's how to do it:

    1. Download the uncompressed version of jQuery.
    2. Find the jQuery.clean method (on line 765: clean: function...).
    3. On line 813, replace:
      div.innerHTML = wrap[1] + arg + wrap[2];
      with:
      div = jQuery.clean.convert(wrap[1] + arg + wrap[2]);
    4. Pack jQuery.
    5. Paste the code in jquery.clean.convert.js below the packed code (important: don't pack jquery.clean.convert.js).

    That's it! You should now have a packed version of jQuery, with a couple of changes to jQuery.clean, and a couple of lines of unpacked code at the bottom.

  2. Don't use packer to compress jQuery.
    Not a very appealing option — packer is great, and compresses better than anything else out there. You could also set packer's encoding option to none (or use another tool like JSMin) to just strip whitespace, but filesize really suffers.