Background
Inserting an ActiveX control (i.e. flash movie, quicktime movie) with an external javascript (i.e. jQuery) should avoid the ugly grey box and having to click to activate.
Bug
ActiveX controls inserted using the packed version of jQuery have the grey box and must be activated. See: jQuery/Packer/ActiveX Bug for more info.
Solution
I've narrowed the problem down to the jQuery.clean method, which uses a temporary div's innerHTML to convert html strings into DOM elements. Doing the conversion from unpacked code fixes the problem, so I'd like to suggest adding a convert hook inside jQuery.clean (see below for patch).
Without the hook, the entire jQuery.clean method has to be overwritten. With the hook, the bug could then be fixed by overwriting jQuery.clean.convert from outside of the packed code (i.e. via a plugin, or by copying and pasting jQuery.clean.convert = function(html) {...} at the bottom of jquery-latest.packed.js).
clean: function(a) {
var r = [];
+ if(!jQuery.clean.convert)
+ jQuery.clean.convert = function(html) {
+ var n = document.createElement('div');
+ div.innerHTML = html;
+ return n;
+ };
jQuery.each( a, function(i,arg){
if ( !arg ) return;
if ( arg.constructor == Number )
arg = arg.toString();
// Convert html string into DOM nodes
if ( typeof arg == "string" ) {
// Trim whitespace, otherwise indexOf won't work as expected
- var s = jQuery.trim(arg), div = document.createElement("div"), tb = [];
+ var s = jQuery.trim(arg), div, tb = [];
var wrap =
// option or optgroup
!s.indexOf("<opt") &&
[1, "<select>", "</select>"] ||
(!s.indexOf("<thead") || !s.indexOf("<tbody") || !s.indexOf("<tfoot")) &&
[1, "<table>", "</table>"] ||
!s.indexOf("<tr") &&
[2, "<table><tbody>", "</tbody></table>"] ||
// <thead> matched above
(!s.indexOf("<td") || !s.indexOf("<th")) &&
[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
[0,"",""];
// Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + s + wrap[2];
+ div = jQuery.clean.convert(wrap[1] + s + wrap[2]);
// Move to the right depth
while ( wrap[0]-- )
div = div.firstChild;
// Remove IE's autoinserted <tbody> from table fragments
if ( jQuery.browser.msie ) {
// String was a <table>, *may* have spurious <tbody>
if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )
tb = div.firstChild && div.firstChild.childNodes;
// String was a bare <thead> or <tfoot>
else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
tb = div.childNodes;
for ( var n = tb.length-1; n >= 0 ; --n )
if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
tb[n].parentNode.removeChild(tb[n]);
}
arg = div.childNodes;
}
if ( arg.length === 0 )
return;
if ( arg[0] == undefined )
r.push( arg );
else
r = jQuery.merge( r, arg );
});
return r;
},