Ticket #831 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

Anchors are eaten by function checkEmpty

Reported by: guest Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: normal Keywords: bug, links, cleanup
Cc:

Description

The following line in function checkEmpty(el) eats anchors on a page during a cleanup operation:

    if ( /^(a|span|b|strong|i|em|font)$/i.test(el.tagName) && !el.firstChild)
    {
      HTMLArea.removeFromParent(el);
      ++stats.empty_tags;
    }

The problem is the a in the list of tags to remove. Anchors are by definition empty tags, but they shouldn't be removed from a page during cleanup because this will break links. Removing the a in the above list solves the problem. While we're here, why not add empty div, span and p tags to this list?

Change History

Changed 7 years ago by guest

  • keywords bug, links, cleanup added

Oh yes, span is already included in the list. But div and p would be good.

Changed 6 years ago by gogo

Changed 6 years ago by gogo

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.