[Greasemonkey] Stripping font tags

Aaron Boodman zboogs at gmail.com
Thu Dec 1 09:20:50 EST 2005


Sure. Untested:

var fontTag;
var parent;
var marker;

// for each font tag
while (fontTag = document.getElementsByTagName("font")[0]) {
  parent = fontTag.parentNode;
  marker = fontTag.nextSibling;

  // move the font tag's child nodes up into the parent in the right place
  while (fontTag.firstChild) {
    parent.insertBefore(fontTag.firstChild, marker);
  }

  // remove the font tag, now that it's empty
  parent.removeChild(fontTag);
}

- a

On 11/30/05, Randy Burke <uncle.ranny at gmail.com> wrote:
> I have an internal work page that i want to skin, the big problem that I am
> having is that it was  wrote with a bad mix of CSS and font tags.
>
> I was just wondering if there is a easy way to strip all the font tags out
> of the page
>
> Randy B.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list