Strip CSS in all browsers (including IE6)


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. (function (all, el, i, l) {
  2. for (i = 0, l = all.length; i < l && el = all[i]; ++i) {
  3. if (/style/i.test(el.nodeName) || (/link/i.test(el.nodeName) && 'stylesheet' === el.getAttribute('rel'))) {
  4. el.parentNode.removeChild(el); --l;
  5. }
  6. else if (null !== el.getAttribute('style')) {
  7. el.removeAttribute('style');
  8. }
  9. }
  10. })(document.all || document.getElementsByTagName('*'))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.