Return to Snippet

Revision: 35329
at November 5, 2010 09:28 by danbeam


Updated Code
(function (all, el, i, l) {
    for (i = 0, l = all.length; i < l && el = all[i]; ++i) {
        if (/style/i.test(el.nodeName) || (/link/i.test(el.nodeName) && 'stylesheet' === el.getAttribute('rel'))) {
            el.parentNode.removeChild(el); --l;
        }
        else if (null !== el.getAttribute('style')) {
            el.removeAttribute('style');
        }
    }
})(document.all || document.getElementsByTagName('*'))

Revision: 35328
at November 5, 2010 09:27 by danbeam


Updated Code
(function (all, el, i, l) {
    for (i = 0, l = all.length; i < l && el = all[i]; ++i) {
        if (/style/i.test(el.nodeName) || (/link/i.test(el.nodeName) && 'stylesheet' === el.getAttribute('rel'))) {
            el.parentNode.removeChild(el); --l;
        }
        else if (undefined !== el.getAttribute('style')) {
            el.removeAttribute('style');
        }
    }
})(document.all || document.getElementsByTagName('*'))

Revision: 35327
at November 5, 2010 09:25 by danbeam


Initial Code
(function (all, el, i, l) {
    for (i = 0, l = all.length; i < l && el = all[i]; ++i) {
        if (/style/i.test(el.nodeName) || (/link/i.test(el.nodeName) && 'stylesheet' === el.getAttribute('rel'))) {
            el.parentNode.removeChild(el); --l;
        }
        else if (el.getAttribute('style')) {
            el.removeAttribute('style');
        }
    }
})(document.all || document.getElementsByTagName('*'))

Initial URL

                                

Initial Description

                                

Initial Title
Strip CSS in all browsers (including IE6)

Initial Tags
css, javascript, ie6

Initial Language
JavaScript