1 // Documentation & updates available at:
2 // http://codecentre.eplica.is/js/eolasfix/test.htm
4 (function( Eolas_Fixed,
13 y,z,elm,childNode,HTML,dummy,eolasfix)
16 if (win[Eolas_Fixed]) return;
19 eolasfix = function ()
21 // for each tag name specified in Array t
24 // find all elements of that type in the document
25 // loop through the elements
27 while (elm = doc[getElementsByTagName](tags[x])[y++])
33 // <param> elements don't show up in innerHTML IE
34 // so we need to collect their outerHTML.
35 while (childNode = elm.childNodes[z++])
36 HTML += childNode[outerHTML];
38 // create a 'dummy' element
39 dummy = doc.createElement('i');
40 // inject it next to `elm`,
41 elm[parentNode].insertBefore(dummy, elm);
42 // and turn it into an `elm` clone
43 dummy[outerHTML] = elm[outerHTML].replace(/>/, HTML);
44 // increment y to skip over it
47 // then hide the original elm
48 elm.style.display = 'none';
49 // and save it in 'The List of Elements to Remove Later'.
50 elmsToRemoveOnload[elmsToRemoveOnload.length] = elm;
54 elm[outerHTML] = elm[outerHTML];
60 // For IE run the fix straight away (because the defer="defer"
61 // attribute has delayed execution until the DOM has loaded).
62 // Then assign a window.onload event to purge the old elements.
63 is_ie && !eolasfix() && win.attachEvent('onload', function(){
65 while(elm = elmsToRemoveOnload[x++])
66 elm[parentNode].removeChild(elm);
68 // For Opera set an `DOMContentLoaded` event to run the fix.
69 win.opera && doc.addEventListener('DOMContentLoaded', eolasfix, 0);
73 'getElementsByTagName',
76 ['object','embed','applet'],